Search in sources :

Example 1 with ImageMapGuideParams

use of ol.source.ImageMapGuideParams in project gwt-ol3 by TDesjardins.

the class MapGuideExample method show.

/* (non-Javadoc)
     * @see de.desjardins.ol3.demo.client.example.Example#show()
     */
@Override
public void show(String exampleId) {
    // create a projection
    Projection projection = Projection.get("EPSG:4326");
    // create a MapGuide params
    ImageMapGuideParams imageMapGuideParams = new ImageMapGuideParams();
    imageMapGuideParams.setFormat("PNG");
    imageMapGuideParams.setMapDefinition("Library://Public/Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
    imageMapGuideParams.setUserName("OpenLayers");
    imageMapGuideParams.setPassword("OpenLayers");
    // create a MapGuide image
    ImageMapGuideOptions imageMapGuideOptions = new ImageMapGuideOptions();
    imageMapGuideOptions.setParams(imageMapGuideParams);
    imageMapGuideOptions.setUrl("http://www.buoyshark.com/mapguide/mapagent/mapagent.fcgi?");
    imageMapGuideOptions.setUseOverlay(false);
    imageMapGuideOptions.setMetersPerUnit(111319.4908d);
    imageMapGuideOptions.setRatio(2.0f);
    ImageMapGuide imageMapGuideSource = new ImageMapGuide(imageMapGuideOptions);
    LayerOptions layerOptions = new LayerOptions();
    Extent bounds = new Extent(-87.865114442365922d, 43.665065564837931d, -87.595394059497067d, 43.823852564430069d);
    layerOptions.setExtent(bounds);
    layerOptions.setSource(imageMapGuideSource);
    Image mapGuideLayer = new Image(layerOptions);
    // create a view
    ViewOptions viewOptions = new ViewOptions();
    viewOptions.setProjection(projection);
    viewOptions.setZoom(12.0d);
    Coordinate centerCoordinate = new Coordinate(-87.7302542509315d, 43.744459064634d);
    viewOptions.setCenter(centerCoordinate);
    View view = new View(viewOptions);
    // create the map
    MapOptions mapOptions = new MapOptions();
    mapOptions.setTarget(exampleId);
    mapOptions.setView(view);
    Collection<Base> lstLayer = new Collection<Base>();
    lstLayer.push(mapGuideLayer);
    mapOptions.setLayers(lstLayer);
    Map map = new Map(mapOptions);
    // add some controls
    map.addControl(new ScaleLine());
    DemoUtils.addDefaultControls(map.getControls());
    // add some interactions
    map.addInteraction(new KeyboardPan());
    map.addInteraction(new KeyboardZoom());
    map.addControl(new Rotate());
}
Also used : ScaleLine(ol.control.ScaleLine) KeyboardPan(ol.interaction.KeyboardPan) Rotate(ol.control.Rotate) Extent(ol.Extent) MapOptions(ol.MapOptions) ViewOptions(ol.ViewOptions) Projection(ol.proj.Projection) Image(ol.layer.Image) LayerOptions(ol.layer.LayerOptions) View(ol.View) ImageMapGuideParams(ol.source.ImageMapGuideParams) Base(ol.layer.Base) ImageMapGuideOptions(ol.source.ImageMapGuideOptions) ImageMapGuide(ol.source.ImageMapGuide) Coordinate(ol.Coordinate) KeyboardZoom(ol.interaction.KeyboardZoom) Collection(ol.Collection) Map(ol.Map)

Aggregations

Collection (ol.Collection)1 Coordinate (ol.Coordinate)1 Extent (ol.Extent)1 Map (ol.Map)1 MapOptions (ol.MapOptions)1 View (ol.View)1 ViewOptions (ol.ViewOptions)1 Rotate (ol.control.Rotate)1 ScaleLine (ol.control.ScaleLine)1 KeyboardPan (ol.interaction.KeyboardPan)1 KeyboardZoom (ol.interaction.KeyboardZoom)1 Base (ol.layer.Base)1 Image (ol.layer.Image)1 LayerOptions (ol.layer.LayerOptions)1 Projection (ol.proj.Projection)1 ImageMapGuide (ol.source.ImageMapGuide)1 ImageMapGuideOptions (ol.source.ImageMapGuideOptions)1 ImageMapGuideParams (ol.source.ImageMapGuideParams)1