[OpenLayers-Users] Problem wth ScaleBar
David R Robison
drrobison at openroadsconsulting.com
Mon Jan 28 16:49:51 EST 2008
Firefox 2.0.0.11 - I will need to check the stylesheets... David
Tim Schaub wrote:
> Hey-
>
> David R Robison wrote:
>
>> Found the problem. I have 10 style sheets loaded into the application.
>> When processing the first, the access to cssRules through the error:
>> NS_ERROR_DOM_INVALID_ACCESS_ERR. This error caused the other style
>> sheets to be ignored. If I replaced the "break" in the catch block with
>> "continue", all was well. David
>>
>
> Yeah, I guessed it was something like that. Can you mention the name of
> your browser? And perhaps give an indication of how your stylesheets
> are included/linked? Do any of your stylesheets have no rules in them?
> I'm curious to see where sheet.cssRules is undefined for one
> stylesheet but not the next.
>
> The patch for #24 is updated. Thanks for any more info.
>
> Tim
>
>
>> Tim Schaub wrote:
>>
>>> Hey-
>>>
>>> Tim Schaub wrote:
>>>
>>>
>>>> Hey-
>>>>
>>>> Can you send me a bit more context? If you can't provide a link to a
>>>> live site, but can send a page (or pages), send directly to me.
>>>>
>>>>
>>> Sorry, and browser info.
>>>
>>>
>>>
>>>> Thanks,
>>>> Tim
>>>>
>>>> David R Robison wrote:
>>>>
>>>>
>>>>> It looks like I have the right code. I think the problem is with the
>>>>> styleValue routine. I have had to modify the following code in the draw
>>>>> function:
>>>>>
>>>>> var vertDisp = 0;
>>>>> for(var classIndex = 0; classIndex < classNames.length;
>>>>> ++classIndex) {
>>>>> var cls = classNames[classIndex];
>>>>> vertDisp = Math.max(
>>>>> vertDisp,
>>>>> this.styleValue(cls, 'top') + this.styleValue(cls, 'height')
>>>>> );
>>>>> }
>>>>> if (vertDisp == 0) vertDisp = 30;
>>>>>
>>>>> The vertDisp value was coming out to be zero. By adding the last line
>>>>> and setting it to 30 it helped, but the bar still looks a bit off. I
>>>>> load a number of style sheets and I think that there is an issue with
>>>>> one that is causing the problem. I suspect the following code in styleValue:
>>>>>
>>>>> if(typeof(sheet.cssRules) == 'undefined') {
>>>>> if(typeof(sheet.rules) == 'undefined') {
>>>>> // can't get rules, assume zero
>>>>> break;
>>>>> } else {
>>>>> allRules = sheet.rules;
>>>>> }
>>>>> } else {
>>>>> allRules = sheet.cssRules;
>>>>> }
>>>>>
>>>>> I am wondering if the "break;" should be a "continue;"? Any thoughts? David
>>>>>
>>>>> Tim Schaub wrote:
>>>>>
>>>>>
>>>>>> Hey-
>>>>>>
>>>>>> David R Robison wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> I was using the one in the tschaub sandbox. David
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> If you take a look at the patch for the scale bar, you'll see there are
>>>>>> some changes required to the default stylesheet.
>>>>>>
>>>>>> http://trac.openlayers.org/attachment/ticket/24/scalebar.patch
>>>>>>
>>>>>> In addition, you'll want to add your stylesheet with a link tag instead
>>>>>> of relying on the default dynamically added stylesheet.
>>>>>>
>>>>>> <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
>>>>>>
>>>>>> Thanks for trying it out. Write back if you still have any trouble with it.
>>>>>>
>>>>>> Tim
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Christopher Schmidt wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> On Mon, Jan 21, 2008 at 06:43:27PM -0500, David R Robison wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> I am trying to get the OpenLayers.Control.ScaleBar working. I've added
>>>>>>>>> it to my map according to the example html. However, when my map draws,
>>>>>>>>> I get the units (in my case 'miles') but it displays at the bottom of
>>>>>>>>> the map and I get no scale bar. Its as if the scale bar is below the map
>>>>>>>>> and hidden. Any thoughts on how to get this to work correctly? Thanks, David
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> Are you adding ScaleBar (which isn't in trunk) or Scale()? OpenLayers
>>>>>>>> does not currently have a ScaleBar control.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> David R Robison
>>>>>>> Open Roads Consulting, Inc.
>>>>>>> 708 S. Battlefield Blvd., Chesapeake, VA 23322
>>>>>>> phone: (757) 546-3401
>>>>>>> e-mail: drrobison at openroadsconsulting.com
>>>>>>> web: http://openroadsconsulting.com
>>>>>>> blog: http://therobe.blogspot.com
>>>>>>> book: http://www.xulonpress.com/book_detail.php?id=2579
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Users mailing list
>>>>>>> Users at openlayers.org
>>>>>>> http://openlayers.org/mailman/listinfo/users
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users at openlayers.org
>>>>>> http://openlayers.org/mailman/listinfo/users
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>>
>>>>> David R Robison
>>>>> Open Roads Consulting, Inc.
>>>>> 708 S. Battlefield Blvd., Chesapeake, VA 23322
>>>>> phone: (757) 546-3401
>>>>> e-mail: drrobison at openroadsconsulting.com
>>>>> web: http://openroadsconsulting.com
>>>>> blog: http://therobe.blogspot.com
>>>>> book: http://www.xulonpress.com/book_detail.php?id=2579
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at openlayers.org
>>>> http://openlayers.org/mailman/listinfo/users
>>>>
>>>> !DSPAM:4033,479e436033035219720167!
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at openlayers.org
>>> http://openlayers.org/mailman/listinfo/users
>>>
>>>
>> --
>>
>> David R Robison
>> Open Roads Consulting, Inc.
>> 708 S. Battlefield Blvd., Chesapeake, VA 23322
>> phone: (757) 546-3401
>> e-mail: drrobison at openroadsconsulting.com
>> web: http://openroadsconsulting.com
>> blog: http://therobe.blogspot.com
>> book: http://www.xulonpress.com/book_detail.php?id=2579
>>
>>
>>
>> !DSPAM:4033,479e4b1f56767082231907!
>>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
--
David R Robison
Open Roads Consulting, Inc.
708 S. Battlefield Blvd., Chesapeake, VA 23322
phone: (757) 546-3401
e-mail: drrobison at openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/book_detail.php?id=2579
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080128/e4a05e45/attachment.html
More information about the Users
mailing list