HSLayers.MapPortal is MapViewer, extended with several HSlayers.Control controls. It is also placed into Ext.Viewport, means it is rendered to entire content of the web page. The OpenLayers.Map object is created automatically, and you only can give it some parameters using mapOptions parameter while initializing.
Example: http://dev.bnhelp.cz/wwwlibs/hslayers/branches/editace/examples/MapPortal.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <script type="text/javascript" src="../source/HS.js"></script>
<script type="text/javascript" src="../source/HSLayers.js"></script>
<script type="text/javascript" src="../source/HSLayers/Util.js"></script>
<script type="text/javascript" src="../source/HSLayers/MapPortal.js"></script>
<script type="text/javascript" src="../source/HSLayers/MapViewer.js"></script>
<script type="text/javascript" src="../source/HSLayers/InfoPanel.js"></script>
<script type="text/javascript" src="../source/HSLayers/OWS.js"></script>
<script type="text/javascript" src="../source/HSLayers/OWS/WMS.js"></script>
<script type="text/javascript" src="../source/HSLayers/OWS/WFS.js"></script>
<script type="text/javascript" src="../source/HSLayers/Printer.js"></script>
<script type="text/javascript" src="../source/HSLayers/MapPanel.js"></script>
<script type="text/javascript" src="../source/HSLayers/MapPanel/HistoryButtons.js"></script>
<script type="text/javascript" src="../source/HSLayers/MapPanel/WMCButtons.js"></script>
<script type="text/javascript" src="../source/HSLayers/MapPanel/WMCForm.js"></script>
<script type="text/javascript" src="../source/HSLayers/Control/LayerSwitcher.js"></script>
<script type="text/javascript" src="../source/HSLayers/Control/ProjectionSwitcher.js"></script>
<script type="text/javascript" src="../source/HSLayers/Control/ScaleSwitcher.js"></script>
<script type="text/javascript" src="../source/HSLayers/Control/Measure.js"></script>
<script type="text/javascript" src="../source/HSLayers/Control/DrawControls.js"></script>
<script type="text/javascript" src="../source/HSLayers/Control/Query.js"></script>
<script type="text/javascript" src="../source/HSLayers/Control/Click.js"></script>
<script type="text/javascript" src="../source/HSLayers/Control/Pin.js"></script>
<script type="text/javascript" src="../source/HSLayers/Control/ArgParser.js"></script>
<script type="text/javascript" src="../source/HSLayers/Control/Permalink.js"></script>
<script type="text/javascript" src="../source/HSLayers/Control/State.js"></script>
<script type="text/javascript" src="../source/HSLayers/Layer/MapServer.js"></script>
<script type="text/javascript" src="../source/HSLayers/Layer/WMS.js"></script>
<script type="text/javascript" src="../source/HSLayers/Layer/WarpedWMS.js"></script>
|
You see, now it’s getting to be hard. How to make this shorter? Again, use the one-file shortcut:
<script type="text/javascript" src="build/MapPortal.js"></script>
Once javascripts are set, it’s going to be easy. Create the MapPortal object and pass the configuration for OpenLayers.Map object along it:
1 2 3 4 5 6 7 8 | var mapOptions = HSLayers.Util.getProjectionOptions("epsg:102067",2000000,500);
mapOptions.initialExtent = new OpenLayers.Bounds(-821745,-1101336,-622249,-1035719);
geoportal = new HSLayers.MapPortal({
mapOptions: mapOptions,
//projections: ["epsg:102067","epsg:900913","epsg:4326"]
projections: ["epsg:102067"]
});
|
Create some map layer and add it to map
1 2 3 4 5 6 7 8 9 10 11 | var topoLayer = new HSLayers.Layer.MapServer("HS-RS (HSRSMapServer)",
"http://www.bnhelp.cz/mapserv/hsmap/hsmap.php",
{project:"cr_hslayers",layers:"hrady_g zamky_g"},
{visibility:false,
saveWMC: false,
isBaseLayer: false,buffer:2});
geoportal.map.addLayers([cuzk_pk,cuzk_kn,topoLayer]);
geoportal.map.zoomToMaxExtent();
|
MapPortal is lying on the top of HSLayers. It uses all it’s components and bunch of server scripts. It has (among others) following functionalities:
In next sections, we will be talking about several HSLayers.Controls and HSLayers.Layer components more detaily.