[OpenLayers-Dev] The dot in the ID name difficults jQuery integration

Tim Schaub tschaub at opengeo.org
Wed Apr 18 10:49:16 EDT 2012


Here's the pull request for removing dots from identifiers:
https://github.com/openlayers/openlayers/pull/416

I think I've got a clear picture of what you're trying to do.  I totally
agree on the needless complexity of popups - they're the next thing to go
in my opinion.  Regarding your efforts to try to use a qtip on the map, you
still shouldn't have to access the DOM elements used to render geometries.
 The OL API provides you with methods to get the appropriate pixel location.

Anyway, I feel your pain.  And I think we should work toward simple
tutorials demonstrating what you're trying to accomplish (use an arbitrary
widget lib to provide things like popups/tips).

Tim

On Tue, Apr 17, 2012 at 1:25 PM, Fernando Norte
<fernando at globalgeo.com.br>wrote:

> HI Tim,
>
> Thanks for the answer.
>
> This "DOT problem" to me it's an incompatible with the W3C Standards, for
> the reason mentioned before.
>
> But, answering you about "why" I want access the DOM element used to
> render a feature:
> The OpenLayers bring a lot of resources and features to build a map, but
> sometimes I need (or prefer) a more rich interface compatible with my
> needs, and I try to do with tools there are more familiar to used it, like
> jQuery and some plugins for example. jQuery and other frameworks created to
> simplify javascript codes generally use this CSS reference to identify an
> object (or multiples) inside the DOM to create interactions. What I wanna
> do is create these interactions relative to the elements that OpenLayers
> are creating.
>
> In my particular case presented, I'd wished to use the qTIP (tooltip
> jQuery plugin - http://craigsworks.com/projects/qtip2/ ) to bring
> information for POINTS (or Clusters), like the OL popUp does, but with a
> better interface.
>
> I confess, although the dot problem had been fixed, I'd no much success
> with qTip and jQuery, because I'll to make all the qTip functions based on
> the all possible interactions of OL like pan, zooming etc to control the
> qTip positions and behaviors, synch with the OL.
>
> I know there is an way to customize better the PopUp, but I need to study
> more and more, because until now is too complex for such a easy thing.
>
> Blame me and the jQuery to make coding more easy than before :D . I'm
> thinking there I'm become lazy, but I don't think a simple thing like the
> PopUp should be so complex to customize.
>
> This is one thing I strongly need and find a way to work, discovered the
> real problem and notice to you, but I'm allways looking for better
> interface solutions than OpenLayers have, saw a lot of projects to merge OL
> with jQuery, ExtJS, and other, most of than start an alpha project and
> abandoned later, but I'm still persuit an way to threat interface more
> independent from OL or more interactive with OL.
>
> I'm not a cartographer, or a geographer, but a programmer for web (as
> advertise) for long time (since 95) that now had been learn about digital
> cartography or GIS and work with. Still learning, but with serious demands
> to make this work, and fine.
>
> Thanks again,
>
>
>
>
> 2012/4/17 Tim Schaub <tschaub at opengeo.org>
>
>> I agree this is something that should be addressed.  The dots in
>> element ids has bugged me for a long time as well.  Here's a commit
>> that is a first step toward correcting things:
>>
>>
>> https://github.com/tschaub/openlayers/commit/53059408084074903212abd4bf7995b3ad4fb0a6
>>
>> I'll issue a pull request when I make some time to address a couple
>> remaining test failures.
>>
>> I am curious why you'd be trying to access the dom element used to
>> render a feature though.  This is something I'd consider unsupported
>> (it won't work with the renderer abstraction in a cross-browser way).
>> Depending on your use case, there's likely a better way to handle
>> interaction or rendered feature access.
>>
>> Tim
>>
>> On Mon, Apr 16, 2012 at 1:33 PM, Fernando Norte
>> <fernando at globalgeo.com.br> wrote:
>> > Hi,
>> >
>> > I have been through a difficult time to integrate jQuery with
>> OpenLayers,
>> > it's because I was trying to relate the elements created by OpenLayers
>> and
>> > the jQuery to get values as position or to use features like Dialog
>> (jquery
>> > UI) or qTIP, or other things.
>> >
>> > The problem I'd realized was in the name of the ID used by OpenLayers
>> in web
>> > elements (like <div> or <svg>), there is dots in the id name, but for
>> jQuery
>> > (and generaly others frameworks who threat like CSS) the dot in the ID
>> is a
>> > separation, that means the class used with the ID. So, I have to create
>> a
>> > scape to the dots.
>> >
>> > Some example:
>> >
>> > The openLayers create the id <circle id="OpenLayers.Geometry.Point_188">
>> > $("#OpenLayers.Geometry.Point_188") <- this is like search this element:
>> > <tag id="OpenLayers" class="Geometry Point_188">
>> >
>> > So I have to create a scape to the dot :
>> > $("#OpenLayers\.Geometry\.Point_188")
>> >
>> > A simple line to a var in javascript solve this problem:
>> > var featID = "#" + f.geometry.id.replace(/\./g,'\\.');
>> > $(featID);
>> >
>> > I'm noticing this and wanna know, if this is a bug or just a suggestion
>> to
>> > better the software, or nothing?
>> > And how is the best way to report this?
>> >
>> > My regards,
>> >
>> > Fernando Norte
>> > Developer at http://Globalgeo.com.br
>> > Nova Lima - MG - Brazil
>> >
>> >
>> >
>> > _______________________________________________
>> > Dev mailing list
>> > Dev at lists.osgeo.org
>> > http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>> >
>>
>>
>>
>> --
>> Tim Schaub
>> OpenGeo http://opengeo.org/
>> Expert service straight from the developers.
>> _______________________________________________
>> Dev mailing list
>> Dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>>
>
>


-- 
Tim Schaub
OpenGeo http://opengeo.org/
Expert service straight from the developers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20120418/479fb100/attachment-0001.html


More information about the Dev mailing list