/*---------------- FILE HEADER --------------------------------------- This file is part of Geoide. Copyright (C) 2005-2006 by: IDgis B.V. http://www.idgis.nl This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: Herman Assink IDgis bv P.O. Box 15 7450 AA Holten The Netherlands E-Mail: herman.assink@idgis.nl * @version 1.4.0 * @author IDgis team * ------------------------------------------------------------------------*/ import nl.idgis.giclient.gui.ContainerContent; class nl.idgis.giclient.gui.mapviewer.MapPicker extends ContainerContent { private var normalColor:Number = 0x949FC8; private var lightColor:Number = 0xffffff; private var darkColor:Number = 0x404040; private var mapPickerItemHeight = 30; private var contentWidth:Number = 0; function onLoad():Void { contentWidth = this._parent._width - 7; var maps:Array = ruler.getGIS().getMaps(); for (var i:Number = 0; i < maps.length; i++) { var mapName:String = maps[i].getName(); var mapTitle:String = maps[i].getTitle(); var mapPickerItem:String = mapName + "nl.idgis.giclient.gui.mapviewer.MapPickerItem"; var depth:Number = i; var yPos:Number = i * mapPickerItemHeight; createEmptyMovieClip(mapPickerItem, depth); this[mapPickerItem]._x = 0; this[mapPickerItem]._y = yPos; drawMapPickerItemBackGround(mapPickerItem); drawMapPickerItemLabel(mapPickerItem, mapTitle); this[mapPickerItem].map = maps[i]; this[mapPickerItem].onRelease = function() { this._parent.ruler.getGIS().setActiveMap(this.map); }; } this._parent.refreshPane(); } private function drawMapPickerItemBackGround(mapPickerItem:String):Void { var upLeftColor:Number = lightColor; var downRightColor:Number = darkColor; this[mapPickerItem].beginFill(normalColor, 80); this[mapPickerItem].lineStyle(1, upLeftColor, 100); this[mapPickerItem].moveTo(0, mapPickerItemHeight - 1); this[mapPickerItem].lineTo(0, 0); this[mapPickerItem].lineTo(contentWidth - 1, 0); this[mapPickerItem].lineStyle(1, downRightColor, 100); this[mapPickerItem].lineTo(contentWidth - 1, mapPickerItemHeight - 1); this[mapPickerItem].lineTo(0, mapPickerItemHeight - 1); this[mapPickerItem].endFill(); } private function drawMapPickerItemLabel(mapPickerItem:String, mapTitle:String):Void { var textFormat:TextFormat = new TextFormat(); textFormat.font = "_sans"; textFormat.size = 11; //textFormat.bold = true; var textFieldWidth:Number = textFormat.getTextExtent(mapTitle).textFieldWidth; var textFieldHeight:Number = textFormat.getTextExtent(mapTitle).textFieldHeight; this[mapPickerItem].createTextField("label", 0, 10, 7, textFieldWidth, textFieldHeight); this[mapPickerItem]["label"].setNewTextFormat(textFormat); this[mapPickerItem]["label"].text = mapTitle; } }