[fusion-commits] r2139 - sandbox/adsk/2.2gp/widgets trunk/text
trunk/widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon Apr 12 12:39:09 EDT 2010
Author: chrisclaydon
Date: 2010-04-12 12:39:07 -0400 (Mon, 12 Apr 2010)
New Revision: 2139
Removed:
trunk/text/fr
trunk/text/fr.json
Modified:
sandbox/adsk/2.2gp/widgets/OverviewMap.js
trunk/widgets/OverviewMap.js
Log:
Fixes #379 - Incorrect overview map initialization sequence caused conflict with the main map.
Modified: sandbox/adsk/2.2gp/widgets/OverviewMap.js
===================================================================
--- sandbox/adsk/2.2gp/widgets/OverviewMap.js 2010-04-08 18:02:52 UTC (rev 2138)
+++ sandbox/adsk/2.2gp/widgets/OverviewMap.js 2010-04-12 16:39:07 UTC (rev 2139)
@@ -26,16 +26,16 @@
/********************************************************************
* Class: Fusion.Widget.OverviewMap
*
- * A widget that displays an overview map showing the current view of the
+ * A widget that displays an overview map showing the current view of the
* primary map.
* **********************************************************************/
Fusion.Widget.OverviewMap = OpenLayers.Class(Fusion.Widget, {
oSize: null,
- nMinRatio: 4,
- nMaxRatio: 32,
+ nMinRatio: 4, // Default value
+ nMaxRatio: 32, // Default value
bDisplayed: false,
-
+
initializeWidget: function(widgetTag) {
var json = widgetTag.extension;
if (json.MinRatio) {
@@ -46,22 +46,10 @@
}
var mapTag = null;
- if (json.MapId) {
- this.sMapGroupId = json.MapId;
- var mapGroup = Fusion.applicationDefinition.getMapGroup(this.sMapGroupId);
- mapTag = mapGroup.maps[0]; //TODO: always use the baselayer Map in the group?
- } else {
- var mainMap = this.getMap();
- mapTag = mainMap.mapGroup.maps[0]; //TODO: always use the baselayer Map in the group?
- }
- if (Fusion.Layers[mapTag.type]) {
- this.mapObject = new Fusion.Layers[mapTag.type](this.getMap(), mapTag, false);
- } else {
- this.mapObject = new Fusion.Layers.Generic(this, mapTag, false);
- }
- //this.mapObject.registerForEvent(Fusion.Event.LAYER_LOADED, OpenLayers.Function.bind(this.loadOverview, this));
- //first set the size to the size of the DOM element if available
+ this.sMapGroupId = json.MapId;
+
+ // Set the size to the size of the DOM element if available
if (this.domObj) {
this.domObj.style.overflow = 'hidden';
var jxl = this.domObj.retrieve('jxLayout');
@@ -70,67 +58,89 @@
}
jxl.addEvent('sizeChange', OpenLayers.Function.bind(this.sizeChanged, this));
}
-
+
this.oMapOptions = {}; //TODO: allow setting some mapOptions in AppDef
this.getMap().registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.mapWidgetLoaded, this));
},
-
- mapWidgetLoaded: function()
+
+ mapWidgetLoaded: function()
{
- var mapWidget = this.getMap();
- if (this.sMapGroupId) {// && (mapWidget.projection == this.mapObject.projection) ) {
- this.loadOverview(this.mapObject.oLayerOL);
- } else {
- //just use the base map layer
- //setTimeout(OpenLayers.Function.bind(this.loadOverview, this), 5000);
- this.loadOverview();
+ var mapTag = null;
+ if (this.sMapGroupId)
+ {
+ // Use the specified map in the overview
+ var mapGroup = Fusion.applicationDefinition.getMapGroup(this.sMapGroupId);
+ mapTag = mapGroup.maps[0]; //TODO: always use the baselayer Map in the group?
}
+ else
+ {
+ // Use the same map as displayed in the main map widget in the overview
+ var mainMap = this.getMap();
+ mapTag = mainMap.mapGroup.maps[0]; //TODO: always use the baselayer Map in the group?
+ }
+
+ if (Fusion.Layers[mapTag.type])
+ {
+ // Create a Fusion layer of the specified type
+ this.mapObject = new Fusion.Layers[mapTag.type](this.getMap(), mapTag, false);
+ }
+ else
+ {
+ // Create a generic Fusion layer (as used by Bing, Google, Yahoo etc.)
+ this.mapObject = new Fusion.Layers.Generic(this, mapTag, false);
+ }
+
+ // Set up the binding so the display initializes when the map configuration has loaded
+ this.mapObject.registerForEvent(Fusion.Event.LAYER_LOADED, OpenLayers.Function.bind(this.loadOverview, this));
},
- loadOverview: function(layer)
+ loadOverview: function()
{
if (this.control) {
this.control.destroy();
}
-
- var size = $(this.domObj).getContentBoxSize();
- this.oSize = new OpenLayers.Size(size.width, size.height);
-
- if (!layer) {
- layer = this.getMap().oMapOL.baseLayer.clone();
- }
- layer.isBaseLayer = true;
- layer.ratio = 1.0;
- if (layer.singleTile) {
- this.oMapOptions.numZoomLevels = 3; //TODO: make this configurable?
- }
- var options = {
- div: this.domObj,
- size: this.oSize,
- minRatio: this.nMinRatio,
- maxRatio: this.nMaxRatio,
- mapOptions: this.oMapOptions,
- layers: [layer]
- };
+ var layer = this.mapObject.oLayerOL;
+ if(layer != null)
+ {
+ var size = $(this.domObj).getContentBoxSize();
+ this.oSize = new OpenLayers.Size(size.width, size.height);
+ layer.isBaseLayer = true;
+ layer.ratio = 1.0;
+ if (layer.singleTile) {
+ this.oMapOptions.numZoomLevels = 3; //TODO: make this configurable?
+ }
- this.control = new OpenLayers.Control.OverviewMap(options);
- if (size.width == 0 || size.height == 0) {
- return; //don't try to load if the container is not visible
- } else {
- this.getMap().oMapOL.addControl(this.control);
- this.bDisplayed = true;
+ var options = {
+ div: this.domObj,
+ size: this.oSize,
+ minRatio: this.nMinRatio,
+ maxRatio: this.nMaxRatio,
+ mapOptions: this.oMapOptions,
+ layers: [layer]
+ };
+
+ this.control = new OpenLayers.Control.OverviewMap(options);
+ if (size.width == 0 || size.height == 0)
+ {
+ return; //don't try to load if the container is not visible
+ }
+ else
+ {
+ this.getMap().oMapOL.addControl(this.control);
+ this.bDisplayed = true;
+ }
+ //console.log('OverviewMap mapLoaded');
}
- //console.log('OverviewMap mapLoaded');
},
-
+
sizeChanged: function() {
var size = $(this.domObj).getContentBoxSize();
this.oSize = new OpenLayers.Size(size.width, size.height);
if (size.width == 0 || size.height == 0) {
return; //don't try to load if the container is not visible
- }
+ }
if (!this.bDisplayed && this.control) {
this.getMap().oMapOL.addControl(this.control);
this.bDisplayed = true;
@@ -145,4 +155,4 @@
}
});
-
+
Deleted: trunk/text/fr
===================================================================
--- trunk/text/fr 2010-04-08 18:02:52 UTC (rev 2138)
+++ trunk/text/fr 2010-04-12 16:39:07 UTC (rev 2139)
@@ -1,335 +0,0 @@
-# Web surround localized strings
-# English language
-#
-# Important: This file must be saved with UTF-8 encoding
-#
-
-# General
-
-# Fonts - the 6 following entries are mandatory
- at fontWindows = Arial
- at fontsizeWindows = 8pt
- at fontLinux = Arial
- at fontsizeLinux = 8pt
- at fontMacintosh = Arial
- at fontsizeMacintosh = 8pt
-
-# Distances
-DISTANCEMILES = Miles
-DISTANCEKILOMETERS = Kilometers
-DISTANCEFEET = Feet
-DISTANCEMETERS = Meters
-
-# Fill Patterns/Values
-FILLSOLID = Solid
-FILLNET = Net
-FILLLINE = Line
-FILLLINE45 = Line_45
-FILLLINE90 = Line_90
-FILLLINE135 = Line_135
-FILLSQUARE = Square
-FILLBOX = Box
-FILLCROSS = Cross
-FILLDASH = Dash
-FILLDOLMIT = Dolmit
-FILLHEX = Hex
-FILLSACNCR = Sacncr
-FILLSTEEL = Steel
-
-# Transparency
-TRANSPARENT = transparent
-
-# Line Styles/Values
-LINESOLID = Solid
-LINEDASH = Dash
-LINEDOT = Dot
-LINEDASHDOT = DashDot
-LINEDASHDOTDOT = DashDotDot
-LINERAIL = Rail
-LINEBORDER = Border
-LINEDIVIDE = Divide
-LINEFENCELINE = FenceLine
-
-# Buttons
-BUTTONOK = OK
-BUTTONDONE = Done
-BUTTONCANCEL = Cancel
-BUTTONREFRESH = Refresh
-BUTTONCLOSE = Close
-BUTTONCLEAR = Clear
-BUTTONSAVE = Save
-
-# Colors
-COLORRED = Red
-COLORGREEN = Green
-COLORBLUE = Blue
-
-# BufferReport
-BUFFERREPORTTITLE = Create Buffer
-BUFFERREPORTCREATED = %s has been created.
-BUFFERREPORTUPDATED = %s has been updated.
-BUFFERREPORTFEATURESSINGULAR = %s buffer feature was created.
-BUFFERREPORTFEATURESPLURAL = %s buffer features were created.
-BUFFERREPORTWARNINGSINGULAR = <b>Warning:</b> %s layer was excluded from buffer computation because its coordinate system is incompatible with the coordinate system of the map, or because it has no coordinate system at all
-BUFFERREPORTWARNINGPLURAL = <b>Warning:</b> %s layers were excluded from buffer computation because their coordinate systems are incompatible with the coordinate system of the map, or because they have no coordinate system at all
-BUFFERREPORTERRORTITLE = Buffer Error
-
-# Buffer
-BUFFERCLASSDESCR = Feature class for buffer layer
-BUFFERSCHEMADESCR = Temporary buffer schema
-BUFFERDIFFARBXY = Cannot compute a unique buffer around features with different 'Arbitrary X-Y' coordinate systems. Please uncheck the option 'Merge buffer areas' or select only one layer
-
-# BufferUI
-BUFFERTITLE = Create a Buffer
-BUFFERSUBTITLE = Buffer settings
-BUFFERINFOTEXT = Select features on the image.
-BUFFERDISTANCE = Distance around features:
-BUFFERLAYERS = Layers to include in the buffer:
-BUFFERNOLAYER = <No layer selected>
-BUFFERNAME = Name for the resulting buffer layer:
-BUFFERNAMETEXT = Buffer 1
-BUFFERMERGE = Merge buffer areas
-BUFFERFILLSTYLE = Fill style
-BUFFERFILLPATTERN = Fill pattern:
-BUFFERFOREGROUNDCOLOR = Foreground color:
-BUFFERTRANSPARENCY = Transparency:
-BUFFERBACKGROUNDCOLOR = Background color:
-BUFFERBORDERSTYLE = Border style
-BUFFERBORDERLINEPATTERN = Line pattern:
-BUFFERBORDERLINECOLOR = Line color:
-BUFFERBORDERLINETHICKNESS = Line thickness:
-BUFFERHELP = <li><p align="left">Results of the buffer are put into a new layer above the top feature layer. This buffer layer has the name you enter here.</li><li><p align="left">To create multiple buffer layers, use different buffer names.</li><li><p align="left">To hide buffer layers, turn them off.</li><li><p align="left">Buffer layers are temporary and are removed when you close the viewer.</li>
-BUFFERERRORZERODISTANCE = Please enter a nonzero distance.
-BUFFERERRORNOLAYERNAME = Please enter a layer name.
-BUFFERERRORNEGATIVETHICKNESS = Please enter positive or null thickness.
-BUFFERERRORNOSELECTION = Please select feature(s) to calculate a buffer around.
-
-# ColorPicker
-COLORPICKERDLGTITLE = Select a color
-COLORPICKERTITLE = Color palette
-COLORPICKERSUBTITLE = Specify a color
-COLORPICKER100TRANSPARENCY = 100%% transparency
-COLORPICKERHEXFORMAT = Hex format
-
-# MeasureUI
-MEASUREDISTANCETITLE = Measure Distance
-MEASUREAREATITLE = Measure Area
-MEASUREBOTHTITLE = Measure Distance And Area
-MEASUREINFO = Click a start and end point.
-RESUME = Resume
-STOP = Stop
-CLEAR = Clear
-MILES = Miles
-KILOMETERS = Kilometers
-MEASUREHELP = <li>To measure multiple distances, continue clicking new points.</li><li>To finish, click "Stop".</li><li>You can pan or zoom and continue measuring by clicking "Resume".</li><li>To start over, click "Clear".</li>
-SEGMENT = Segment
-TOTAL = Total
-LENGTH = Length
-TOTALLENGTH = Total Length
-TOTALAREA = Total Area
-MEASUREERROR = Measure Error
-
-# Measure
-MEASUREFEATURECLASS = Feature class for measure layer
-MEASURESCHEMADESCR = Temporary measure schema
-MEASUREPARTIAL = Partial
-MEASURETOTAL = total
-MEASURELAYER = Measure
-
-# FeatureInfoUI
-FEATUREINFOTITLE = Feature Information
-FEATUREINFOSUBTITLE = Select a Layer
-FEATUREINFOLAYER = Layer:
-FEATUREINFOSELECTFEATURE= Select Features:
-FEATUREINFODIGITIZE = Digitize:
-FEATUREINFOPOINT = Point
-FEATUREINFORECTANGLE = Rectangle
-FEATUREINFOPOLYGON = Polygon
-FEATUREINFOTOTAL = Total:
-FEATUREINFONOSELECTED = no features selected.
-FEATUREINFOERROR = Error
-FEATUREINFOFETCHINFO = fetching feature info ...
-FEATUREINFOFEATURESEL = features selected
-FEATUREINFOAREA = Area:
-FEATUREINFOAREAUNDEFINE = areaIdx undefined
-FEATUREINFONOINFO = no layer info
-FEATUREINFONOFEATUREIN = no features in selected layer.
-
-# QueryUI
-QUERYTITLE = Query Features
-QUERYSELECTLAYER = Select a Layer
-QUERYLAYER = Layer:
-QUERYPROPERTYFILTER = Property Filter
-QUERYPROPERTY = Property:
-QUERYOPERATOR = Operator:
-QUERYVALUE = Value:
-QUERYSPATIALFILTER = Spatial Filter
-QUERYDIGITIZE = Digitize:
-QUERYRECTANGLE = Rectangle
-QUERYPOLYGON = Polygon
-QUERYCLEAR = Clear
-QUERYOUTPUT = Output
-QUERYOUTPUTPROPERTY = Output property:
-QUERYEXECUTE = Execute
-QUERYMAXRESULT = Max results:
-QUERYRESULTS = Results
-QUERYSCALE = Scale:
-QUERYZOOM = Zoom
-QUERYSELECT = Select
-QUERYERROR = Error
-QUERYEQUALTO = Equal to
-QUERYNOTEQUALTO = Not equal to
-QUERYGREATTHAN = Greater than
-QUERYGREATTHANEQUAL = Greater than or equal to
-QUERYLESSTHAN = Less than
-QUERYLESSTHANEQUAL = Less than or equal to
-QUERYBEGIN = Begins with
-QUERYCONTAINS = Contains
-
-# Theme UI
-THEMETITLE = Theme Layer
-THEMESELECTLAYER = Select a Layer
-THEMELAYER = Layer:
-THEMENAME = Theme Name:
-THEMECONDITIONS = Define Conditions
-THEMEPROPERTY = Property:
-THEMEMIN = Min:
-THEMEMAX = Max:
-THEMEDISTRIBUTION = Distribution:
-THEMERULE = # of Rules:
-THEMESCALERANGE = Scale Range
-THEMESTYLERAMP = Style Ramp
-THEMEFILLTRANS = Fill Transparency:
-THEMEFILLCOLOR = Fill Color:
-THEMEFROM = From:
-THEMETO = To:
-THEMEBORDERCOLOR = Border Color:
-THEMEAPPLY = Apply
-THEMEERROR = Error
-THEMEINDIVIDUAL = Individual
-THEMEEQUAL = Equal
-THEMESTANDARD = Standard Deviation
-THEMEQUANTILE = Quantile
-THEMEJENKS = Jenks (Natural Breaks)
-
-# Redline UI
-REDLINEOPTIONS = Digitizing Options
-REDLINESELECTLAYER = Select Layer:
-REDLINENEW = New
-REDLINERENAME = Rename
-REDLINEREMOVE = Remove
-REDLINEDRAW = Draw:
-REDLINEPOINT = Point
-REDLINELINE = Line
-REDLINERECTANGLE = Rectangle
-REDLINEPOLYGON = Polygon
-REDLINESAVE = Save
-REDLINEUPLOAD = Upload
-REDLINEFEATURES = Features
-
-# HtmlViewerAbout
-HTMLABOUTTITLE = About %s
-HTMLABOUTTITLEBAR = MapGuide Viewer
-HTMLABOUTSERVERTITLE = MapGuide Server
-HTMLABOUTVIEWERTITLE = MapGuide Viewer
-HTMLABOUTSERVERVERSION = %s (Version %s)
-HTMLABOUTVIEWERVERSION = %s (Version %s)
-HTMLABOUTTEXT = <br>This product is made available subject to the terms of GNU Lesser General Public License Version 2.1 ("LGPL"). A copy of the LGPL, as well as additional copyright notices and license terms applicable to portions of this product are set forth in the <a href="../localized/license_en.htm" target="blank">license</a> file.<br><br>All trademarks and registered trademarks mentioned herein are the property of their respective owners.<br><br>Copyright © 2007 Autodesk, Inc.<br><br>
-HTMLABOUTLICENSE = license file
-HTMLABOUTLICENSEFILE = license_en.htm
-
-# LegendUI
-LEGENDLISTSEPARATOR = ,
-
-# PrintablePageUi
-PRINTTITLE = Get Printable Page
-PRINTELEMENTS = Select the elements to include in the print layout.
-PRINTPAGETITLE = Page title:
-PRINTLEGEND = Legend
-PRINTNORTHARROW = North arrow
-PRINTCREATEPAGE = Create Page
-
-# PropertyCtrl
-PROPERTIESNONE = None Selected
-PROPERTIESNAME = Name
-PROPERTIESVALUE = Value
-PROPERTIESITEMSEL = Items selected: {0}
-
-# Search
-SEARCHDLGTITLE = Search features
-SEARCHTITLE = Search results
-SEARCHERROR = Search error
-SEARCHREPORT = Search report
-SEARCHLAYERNOTFOUND = Layer {0} not found!
-SEARCHNOMULTIPROP = Multi-properties identity not supported yet
-SEARCHTYYPENOTSUP = Identity property type not supported yet ({0})
-SEARCHNOMATCHES = No matches.
-
-# SearchPrompt
-SEARCHPROMPTFIND = Find
-
-# SelectWithinUi
-SELECTWITHINTITLE = Select Within
-SELECTWITHINAREAS = Select areas on the image.
-SELECTWITHINRESTRICTION = Restrict results to selected layers:
-SELECTWITHINTEXT = <li>If you continue to select areas on the image, click "Refresh" to update the layer list.</li><li>To finish and select all features within the highlighted areas, click "Done".</li><li>To start over, click "Clear".</li>
-
-# Error/Report
-REPORTTITLE = Report
-
-# Legend UI
-REFRESH = Refresh
-EXPANDALL = Expand
-COLLAPSEALL = Collapse All
-DISPLAYALLINGROUP = Display All in Group
-HIDEALLINGROUP = Hide All in Group
-SHOWLONGTHEME = Show Long Theme
-
-# Task Bar
-TASKS = Tasks
-
-# Viewer Options
-OPTIONSTITLE = Viewer Options
-OPTIONSINFOTEXT = Select viewing options for status bar and tool tips.
-OPTIONSDISTANCE = Display distances in
-OPTIONSMETRIC = Metric (Kilometers, Meters)
-OPTIONSUSENGLISH = US/English (Miles, Feet)
-OPTIONSPOSITION = Display cursor position in
-OPTIONSLATLON = Latitude, Longitude (Degrees)
-OPTIONSMAPUNITS = Map Coordinate System (X,Y)
-
-# AJAX Viewer
-VIEWERLAYERS = Layers
-VIEWERPROPS = Properties
-VIEWERPANNORTH = Pan North
-VIEWERPANWEST = Pan West
-VIEWERPANSOUTH = Pan South
-VIEWERPANEAST = Pan East
-VIEWERZOOMIN = Zoom In
-VIEWERZOOMOUT = Zoom Out
-VIEWERMOVESLIDER = Drag to move slider
-VIEWERDRAGZOOM = Drag to zoom
-ENDSEL = CTRL + click to end
-ENDSELSAFARI = SHIFT + click to end
-DECIMALSEPARATOR = .
-THOUSANDSEPARATOR = ,
-
-# Main Frame
-NEEDLOGIN = You must enter a valid login ID and password to access this site
-ALREADYINMEASURE = Only one measure command is allowed in a web layout
-ACCESSDENIED = Access Denied
-LATLONCURPOS = Lat: {0}, Lon: {1}
-MAPUNITSCURPOS = X: {0}, Y: {1}
-FEATURESSELECTED = {0} features selected
-FEATURESELECTED = {0} feature selected
-MI = mi
-FT = ft
-IN = in
-KM = km
-MT = m
-CM = cm
-DIGALREADYRUNNING = Cannot execute measure: A digitization command is in progress.
-MEASALREADYRUNNING = Cannot execute digitization: A measure is in progress.
-
-# Localized Icon Files
-POWEREDBYICON = PoweredBy_en.gif
Deleted: trunk/text/fr.json
===================================================================
--- trunk/text/fr.json 2010-04-08 18:02:52 UTC (rev 2138)
+++ trunk/text/fr.json 2010-04-12 16:39:07 UTC (rev 2139)
@@ -1,54 +0,0 @@
-Fusion.Strings.fr = {
-'scriptFailed': 'failed to load script: ${script}',
-'configParseError': 'Error parsing fusion configuration file, initialization aborted',
-'configLoadError': 'Error loading fusion configuration file, initialization aborted.' +
- 'Make sure that you have copied config_dist.json to config.json ' +
- 'and have configured the settings for your system',
-'ajaxError': 'Exception occurred in AJAX callback.\n${exception}\nLocation: ${file} (${line}))',
-'importFailed': 'failed to import stylesheet: ${url}',
-'registerEventError': 'Error registering eventID, invalid (empty) eventID.',
-'appDefLoadFailed': 'failed to load: ${script}',
-'appDefParseError': 'failed to parse ApplicationDefinition',
-'widgetSetParseError': 'failed to parse the WidgetSet',
-'fusionError': 'Fusion Error: ${type}\n${message}',
-'nullExtents': 'Map.setExtents called with null extents',
-'mapLoadError': 'Failed to load requested map:\n${error}',
-'setLayersError': "setLayers failure: ${error}",
-'printTitle': 'Printable Page ',
-'noSelection': 'Aucun Sélection',
-'selectionInfo': '${features} feature(s) selected on ${layers} layer(s)',
-'attribute': 'Attribute',
-'value': 'Value',
-'taskHome': 'return to the task pane home',
-'prevTask': 'go to previous task executed',
-'nextTask': 'go to next task executed',
-'taskList': 'Task List',
-'taskPane': 'Task Pane',
-'imperial': 'Imperial',
-'metric': 'Metric',
-'deg': 'Degrees',
-'refresh': 'Refresh',
-'expandAll': 'Expand All',
-'expand': 'Expand',
-'collapseAll': 'Collapse All',
-'collapse': 'Collapse',
-'defaultMapTitle': 'Map',
-'legendTitle': 'Legend',
-'selectionPanelTitle': 'Sélection',
-'ovmapTitle': 'Overview Map',
-'ovmapTitleShort': 'Overview',
-'taskPaneTitle': 'Tasks',
-'segment': 'Segment ${seg}',
-'calculating': 'calculating ...',
-'panWest': 'Ouest',
-'panEast': 'Est',
-'panSouth': 'Sud',
-'panNorth': 'Nord',
-'zoomOut': 'Cliquer pour réduire',
-'zoomIn': 'Cliquer pour agrandir',
-'printCancel': 'Cancel',
-'printGenerate': 'Generate',
-'maptipLinkText': 'Cliquer pour plus d information',
-
-'end': ''
-};
Modified: trunk/widgets/OverviewMap.js
===================================================================
--- trunk/widgets/OverviewMap.js 2010-04-08 18:02:52 UTC (rev 2138)
+++ trunk/widgets/OverviewMap.js 2010-04-12 16:39:07 UTC (rev 2139)
@@ -26,16 +26,16 @@
/********************************************************************
* Class: Fusion.Widget.OverviewMap
*
- * A widget that displays an overview map showing the current view of the
+ * A widget that displays an overview map showing the current view of the
* primary map.
* **********************************************************************/
Fusion.Widget.OverviewMap = OpenLayers.Class(Fusion.Widget, {
oSize: null,
- nMinRatio: 4,
- nMaxRatio: 32,
+ nMinRatio: 4, // Default value
+ nMaxRatio: 32, // Default value
bDisplayed: false,
-
+
initializeWidget: function(widgetTag) {
var json = widgetTag.extension;
if (json.MinRatio) {
@@ -46,22 +46,10 @@
}
var mapTag = null;
- if (json.MapId) {
- this.sMapGroupId = json.MapId;
- var mapGroup = Fusion.applicationDefinition.getMapGroup(this.sMapGroupId);
- mapTag = mapGroup.maps[0]; //TODO: always use the baselayer Map in the group?
- } else {
- var mainMap = this.getMap();
- mapTag = mainMap.mapGroup.maps[0]; //TODO: always use the baselayer Map in the group?
- }
- if (Fusion.Layers[mapTag.type]) {
- this.mapObject = new Fusion.Layers[mapTag.type](this.getMap(), mapTag, false);
- } else {
- this.mapObject = new Fusion.Layers.Generic(this, mapTag, false);
- }
- //this.mapObject.registerForEvent(Fusion.Event.LAYER_LOADED, OpenLayers.Function.bind(this.loadOverview, this));
- //first set the size to the size of the DOM element if available
+ this.sMapGroupId = json.MapId;
+
+ // Set the size to the size of the DOM element if available
if (this.domObj) {
this.domObj.style.overflow = 'hidden';
var jxl = this.domObj.retrieve('jxLayout');
@@ -70,67 +58,89 @@
}
jxl.addEvent('sizeChange', OpenLayers.Function.bind(this.sizeChanged, this));
}
-
+
this.oMapOptions = {}; //TODO: allow setting some mapOptions in AppDef
this.getMap().registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.mapWidgetLoaded, this));
},
-
- mapWidgetLoaded: function()
+
+ mapWidgetLoaded: function()
{
- var mapWidget = this.getMap();
- if (this.sMapGroupId) {// && (mapWidget.projection == this.mapObject.projection) ) {
- this.loadOverview(this.mapObject.oLayerOL);
- } else {
- //just use the base map layer
- //setTimeout(OpenLayers.Function.bind(this.loadOverview, this), 5000);
- this.loadOverview();
+ var mapTag = null;
+ if (this.sMapGroupId)
+ {
+ // Use the specified map in the overview
+ var mapGroup = Fusion.applicationDefinition.getMapGroup(this.sMapGroupId);
+ mapTag = mapGroup.maps[0]; //TODO: always use the baselayer Map in the group?
}
+ else
+ {
+ // Use the same map as displayed in the main map widget in the overview
+ var mainMap = this.getMap();
+ mapTag = mainMap.mapGroup.maps[0]; //TODO: always use the baselayer Map in the group?
+ }
+
+ if (Fusion.Layers[mapTag.type])
+ {
+ // Create a Fusion layer of the specified type
+ this.mapObject = new Fusion.Layers[mapTag.type](this.getMap(), mapTag, false);
+ }
+ else
+ {
+ // Create a generic Fusion layer (as used by Bing, Google, Yahoo etc.)
+ this.mapObject = new Fusion.Layers.Generic(this, mapTag, false);
+ }
+
+ // Set up the binding so the display initializes when the map configuration has loaded
+ this.mapObject.registerForEvent(Fusion.Event.LAYER_LOADED, OpenLayers.Function.bind(this.loadOverview, this));
},
- loadOverview: function(layer)
+ loadOverview: function()
{
if (this.control) {
this.control.destroy();
}
-
- var size = $(this.domObj).getContentBoxSize();
- this.oSize = new OpenLayers.Size(size.width, size.height);
-
- if (!layer) {
- layer = this.getMap().oMapOL.baseLayer.clone();
- }
- layer.isBaseLayer = true;
- layer.ratio = 1.0;
- if (layer.singleTile) {
- this.oMapOptions.numZoomLevels = 3; //TODO: make this configurable?
- }
- var options = {
- div: this.domObj,
- size: this.oSize,
- minRatio: this.nMinRatio,
- maxRatio: this.nMaxRatio,
- mapOptions: this.oMapOptions,
- layers: [layer]
- };
+ var layer = this.mapObject.oLayerOL;
+ if(layer != null)
+ {
+ var size = $(this.domObj).getContentBoxSize();
+ this.oSize = new OpenLayers.Size(size.width, size.height);
+ layer.isBaseLayer = true;
+ layer.ratio = 1.0;
+ if (layer.singleTile) {
+ this.oMapOptions.numZoomLevels = 3; //TODO: make this configurable?
+ }
- this.control = new OpenLayers.Control.OverviewMap(options);
- if (size.width == 0 || size.height == 0) {
- return; //don't try to load if the container is not visible
- } else {
- this.getMap().oMapOL.addControl(this.control);
- this.bDisplayed = true;
+ var options = {
+ div: this.domObj,
+ size: this.oSize,
+ minRatio: this.nMinRatio,
+ maxRatio: this.nMaxRatio,
+ mapOptions: this.oMapOptions,
+ layers: [layer]
+ };
+
+ this.control = new OpenLayers.Control.OverviewMap(options);
+ if (size.width == 0 || size.height == 0)
+ {
+ return; //don't try to load if the container is not visible
+ }
+ else
+ {
+ this.getMap().oMapOL.addControl(this.control);
+ this.bDisplayed = true;
+ }
+ //console.log('OverviewMap mapLoaded');
}
- //console.log('OverviewMap mapLoaded');
},
-
+
sizeChanged: function() {
var size = $(this.domObj).getContentBoxSize();
this.oSize = new OpenLayers.Size(size.width, size.height);
if (size.width == 0 || size.height == 0) {
return; //don't try to load if the container is not visible
- }
+ }
if (!this.bDisplayed && this.control) {
this.getMap().oMapOL.addControl(this.control);
this.bDisplayed = true;
@@ -145,4 +155,4 @@
}
});
-
+
More information about the fusion-commits
mailing list