[mapguide-users] Change map scale or get min and max scale
from layer
Lukas Hybner
hybner at atlas.cz
Wed Oct 15 03:59:13 EDT 2008
Thank you very much, this is exactly what I need.
I append my code as example:
MgByteReader layerXml =
resourceSrvc.GetResourceContent(layer.GetLayerDefinition());
layerXml.ToString(); //This return the XML
Lukas Hybner
Kenneth Skovhede, GEOGRAF A/S píše v Út 14. 10. 2008 v 14:02 +0200:
> IIRC, IsVisible() is the same as GetVisible(), which is a property that
> determines if the layer is visible.
> If the layer is "visible", it will be displayed, but only appears in the
> map at predefined scale ranges.
>
> The scale ranges are actually present in the layer object, but not
> accesible from the API.
> You have to read out the LayerDefinition ResourceIdentifier, load the
> xml from the LayerDefinition, and find the <VectorScaleRange> tags:
> <VectorScaleRange>
> <MinScale>0</MinScale>
> <MaxScale>100</MaxScale>
> </VectorScaleRange>
>
> Be aware that both <MinScale> and <MaxScale> may be missing, in which
> case they are 0 and inifinite respectively.
>
> Regards, Kenneth Skovhede, GEOGRAF A/S
>
>
>
> Lukas Hybner skrev:
> > Hi all,
> >
> > I have a problem when I show tree of layers. I need to know if the layer
> > is Visible or not.
> >
> > For Example client send scale=5000000 and some layers is visible from 1
> > to 4000. When I want to know if the layers is visible, I use method
> > isVisible(). This method return always true because map.getViewScale()
> > returns 1.0 (not 5000000).
> >
> > My code is (in jsp):
> >
> > String mapDefinition = "some map definition";
> > MgMap map = new MgMap();
> > MgResourceIdentifier resId = new MgResourceIdentifier(mapDefinition);
> > String mapName = resId.GetName();
> > map.Create(resourceSrvc, resId, mapName);
> >
> > MgGeometryFactory factory = new MgGeometryFactory();
> > MgCoordinate centerCoord = factory.CreateCoordinateXY(centerx,centery);
> >
> >
> > //here is scale property from client
> > MgByteReader mgImage = renderingSrvc.RenderMap( map, null, centerCoord,
> > scale,width, height, color, "JPG" );
> >
> > out.println(map.GetViewScale()); //returns 1.0
> >
> > MgLayerCollection layers = map.GetLayers();
> > for (int i = 0; i < layers.GetCount(); ++i)
> > out.println( (layers.GetItem(i).isVisible ? "on" : "off") );
> > //this write on
> >
> >
> > How can I change scale in object map? Or is some other solution? Or can
> > I read from layer object min and max scale?
> >
> > Lukas Hybner
> >
> >
> > _______________________________________________
> > mapguide-users mailing list
> > mapguide-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapguide-users
> >
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>
>
More information about the mapguide-users
mailing list