public TileGenerator(string mapfile, string savePath, string tileListId) { try { id = tileListId; string version = Apis.MapServer.VersionSupport; var gdalPlugins = new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, "gdalplugins")); Apis.Gdal.Driver.GdalDriverPath = gdalPlugins; Apis.Gdal.Driver.Register(); Apis.Ogr.Driver.Register(); var curlCaBundleCrt = new FileInfo(Path.Combine(Environment.CurrentDirectory, "curl-ca-bundle.crt")); Apis.Curl.SetCurlCertificateAuthorityBundleEnvironment(curlCaBundleCrt); var projLib = new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, "ProjLib")); Apis.Proj.ProjLibDirectory = projLib; Apis.Gdal.Data.GdalDataDirectory = new DirectoryInfo(Environment.CurrentDirectory); map = new mapObj(mapfile); ProcessTileList(savePath, tileListId); } catch (Exception ex) { ExceptionDump(ex); } }
public static bool RenameDuplicatedNames(mapObj map) { bool hasDuplicate = false; for (int i = 0; i < map.numlayers; i++) { layerObj layer = map.getLayer(i); if (layer.name == "__embed__scalebar" || layer.name == "__embed__legend") { continue; } string originalName = layer.name; if (originalName == null) { originalName = "layer"; } layer.name = null; string versionedName = GetUniqueLayerName(map, originalName, 0); layer.name = originalName; if (originalName.Trim() != versionedName) { hasDuplicate = true; layer.name = versionedName; } } return(hasDuplicate); }
public TileGenerator(string mapfile, string savePath, string tileListId) { try { id = tileListId; string version = mapscript.msGetVersion(); if (Directory.Exists(Environment.CurrentDirectory + "\\gdalplugins")) Gdal.SetConfigOption("GDAL_DRIVER_PATH", Environment.CurrentDirectory + "\\gdalplugins"); Gdal.AllRegister(); Ogr.RegisterAll(); mapscript.SetEnvironmentVariable("CURL_CA_BUNDLE=" + Environment.CurrentDirectory + "\\curl-ca-bundle.crt"); MapUtils.SetPROJ_LIB(Environment.CurrentDirectory + "\\ProjLib"); Gdal.SetConfigOption("GDAL_DATA", Environment.CurrentDirectory); map = new mapObj(mapfile); ProcessTileList(savePath, tileListId); } catch (Exception ex) { ExceptionDump(ex); } }
/// <summary> /// Creating a new map. /// </summary> /// <returns>The wrapper containing the newly created map object.</returns> public static MapObjectHolder CreateMap() { mapObj map = new mapObj(null); map.setExtent(0, 0, 100, 100); return(new MapObjectHolder(map, null)); }
public static void Load(string fileName) { styles = MapUtils.OpenMap(fileName); map = styles; styleLibFileName = fileName; // get symbolset file name string styleDir = Path.GetDirectoryName(fileName); if (File.Exists(map.symbolset.filename)) { symbolsetFileName = map.symbolset.filename; } else { throw new Exception("Cannot load Symbolset file." + map.symbolset.filename); } if (File.Exists(map.fontset.filename)) { fontsetFileName = map.fontset.filename; } else { throw new Exception("Cannot load Fontset file. " + map.fontset.filename); } ExpandFontStyles(); }
/// <summary> /// Constructs a new AddWMSLayerForm class. /// </summary> public AddWMSLayerForm(MapObjectHolder target) { InitializeComponent(); if (target.GetType() != typeof(mapObj)) { throw new ApplicationException("Invalid object type."); } this.map = target; this.target = target; var keyDown = Observable.FromEventPattern <KeyEventArgs>(this, "KeyDown"); keyDown.Subscribe(evt => { if (evt.EventArgs.KeyCode == Keys.Escape) { Close(); } }); this.Bind(ViewModel, vm => vm.ServerUrl, v => v.textBoxServer.Text); this.BindCommand(ViewModel, a => a.Load, b => b.buttonLoadLayers); // TODO: Handle Loading in ViewModel ViewModel = new AddWMSLayerFormViewModel(target); UpdateControls(); }
public static void SetDefaultLabel(labelObj label, mapObj map) { label.size = 8; label.force = mapscript.MS_FALSE; label.partials = mapscript.MS_TRUE; label.position = (int)MS_POSITIONS_ENUM.MS_CC; // trying to set truetype fonts if (map != null) { string key = null; string lastkey = null; while ((key = map.fontset.fonts.nextKey(key)) != null) { if (File.Exists(map.fontset.fonts.get(key, ""))) { lastkey = key; if (string.Compare(key, "arial", true) == 0) { // set the default font to Arial if exists break; } } } if (lastkey != null) { label.font = lastkey; label.size = 8; } } }
public static void Main(string[] args) { if (args.Length < 2) usage(); try { mapObj map = new mapObj(args[0]); using(imageObj image = map.draw()) { // solution 1 Console.WriteLine ("Drawing map: '" + map.name + "' using imageObj.getBytes"); byte[] img = image.getBytes(); using (MemoryStream ms = new MemoryStream(img)) { Image mapimage = Image.FromStream(ms); mapimage.Save(args[1]); } // solution 2 Console.WriteLine ("Drawing map: '" + map.name + "' using imageObj.write"); using (FileStream fs = File.Open("_" + args[1], FileMode.OpenOrCreate, FileAccess.ReadWrite)) { image.write(fs); } } } catch (Exception ex) { Console.WriteLine( "GetBytes: ", ex.Message ); } }
public static void Main(string[] args) { Console.WriteLine(""); if (args.Length < 3 || args.Length > 4) usage(); bool ZoomToResults = (args.Length == 4 && args[3] == "-zoom"); mapObj map = new mapObj(args[0]); Console.WriteLine ("# Map layers " + map.numlayers + "; Map name = " + map.name); QueryByAttribute(args[1], map, ZoomToResults); map.querymap.status = mapscript.MS_ON; map.querymap.color.setRGB(0,0,255,255); map.querymap.style = (int)MS_QUERYMAP_STYLES.MS_HILITE; try { imageObj image = map.drawQuery(); image.save(args[2],map); } catch (Exception ex) { Console.WriteLine( "QueryMap: ", ex.Message ); } }
public TileGenerator(string mapfile, string savePath, string tileListId) { try { id = tileListId; string version = mapscript.msGetVersion(); if (Directory.Exists(Environment.CurrentDirectory + "\\gdalplugins")) { Gdal.SetConfigOption("GDAL_DRIVER_PATH", Environment.CurrentDirectory + "\\gdalplugins"); } Gdal.AllRegister(); Ogr.RegisterAll(); mapscript.SetEnvironmentVariable("CURL_CA_BUNDLE=" + Environment.CurrentDirectory + "\\curl-ca-bundle.crt"); MapUtils.SetPROJ_LIB(Environment.CurrentDirectory + "\\ProjLib"); Gdal.SetConfigOption("GDAL_DATA", Environment.CurrentDirectory); map = new mapObj(mapfile); ProcessTileList(savePath, tileListId); } catch (Exception ex) { ExceptionDump(ex); } }
public static void Main(string[] args) { Console.WriteLine(""); if (args.Length < 3 || args.Length > 4) { usage(); } bool ZoomToResults = (args.Length == 4 && args[3] == "-zoom"); mapObj map = new mapObj(args[0]); Console.WriteLine("# Map layers " + map.numlayers + "; Map name = " + map.name); QueryByAttribute(args[1], map, ZoomToResults); map.querymap.status = mapscript.MS_ON; map.querymap.color.setRGB(0, 0, 255, 255); map.querymap.style = (int)MS_QUERYMAP_STYLES.MS_HILITE; try { imageObj image = map.drawQuery(); image.save(args[2], map); } catch (Exception ex) { Console.WriteLine("QueryMap: ", ex.Message); } }
/// <summary> /// Update the preview according to the current Editor state. /// In case of the preview a temporary object will only be updated. /// </summary> public void UpdateValues() { if (style == null) { return; } if (dirtyFlag) { Update(this.style); // copy symbol to the map if needed if (listView.SelectedItems.Count > 0 && listView.SelectedItems[0].Text != "Default") { // try to find symbol int symbolIndex; string symbolName = listView.SelectedItems[0].Text; for (symbolIndex = 0; symbolIndex < map.symbolset.numsymbols; symbolIndex++) { if (map.symbolset.getSymbol(symbolIndex).name == symbolName) { break; } } if (symbolIndex == map.symbolset.numsymbols && comboBoxCategory.Text != "Inline Symbols") { // copy symbol from style library mapObj sourceMap = StyleLibrary.Styles; // removing the embedded scalebar symbol from top (should be fixed in mapserver) string lastsymbolName = map.symbolset.getSymbol(map.symbolset.numsymbols - 1).name; if (lastsymbolName == "scalebar" || lastsymbolName == "legend") { map.symbolset.removeSymbol(map.symbolset.numsymbols - 1); } lastsymbolName = map.symbolset.getSymbol(map.symbolset.numsymbols - 1).name; if (lastsymbolName == "scalebar" || lastsymbolName == "legend") { map.symbolset.removeSymbol(map.symbolset.numsymbols - 1); } symbolIndex = map.symbolset.appendSymbol(MapUtils.CloneSymbol( sourceMap.symbolset.getSymbolByName(symbolName))); } style.symbolname = symbolName; style.symbol = symbolIndex; } else { // remove symbol style.symbol = 0; style.symbolname = null; } SetDirty(false); if (target != null) { target.RaisePropertyChanged(this); } } }
public static void Main(string[] args) { Console.WriteLine(""); if (args.Length < 2) usage(); mapObj map = new mapObj(args[0]); Console.WriteLine("# Map layers " + map.numlayers + "; Map name = " + map.name); for (int i = 0; i < map.numlayers; i++) { Console.WriteLine("Layer [" + i + "] name: " + map.getLayer(i).name); } try { WriteableBitmap mapImage = new WriteableBitmap(map.width, map.height, 96, 96, PixelFormats.Bgr32, null); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); using (imageObj image = map.draw()) { // Reserve the back buffer for updates. mapImage.Lock(); try { if (image.getRawPixels(mapImage.BackBuffer) == (int)MS_RETURN_VALUE.MS_FAILURE) { Console.WriteLine("Unable to get image contents"); } // Specify the area of the bitmap that changed. mapImage.AddDirtyRect(new Int32Rect(0, 0, map.width, map.height)); } finally { // Release the back buffer and make it available for display. mapImage.Unlock(); } Console.WriteLine("Rendering time: " + stopwatch.ElapsedMilliseconds + "ms"); // Save the bitmap into a file. using (FileStream stream = new FileStream(args[1], FileMode.Create)) { PngBitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(mapImage)); encoder.Save(stream); } } } catch (Exception ex) { Console.WriteLine( "\nMessage ---\n{0}", ex.Message ); Console.WriteLine( "\nHelpLink ---\n{0}", ex.HelpLink ); Console.WriteLine( "\nSource ---\n{0}", ex.Source ); Console.WriteLine( "\nStackTrace ---\n{0}", ex.StackTrace ); Console.WriteLine( "\nTargetSite ---\n{0}", ex.TargetSite ); } }
public ScriptConsoleForm(MapObjectHolder mapH) { InitializeComponent(); this.mapH = mapH; this.map = mapH; ListSupportedLanguages(); }
/// <summary> /// Constructs a new AddWMSLayerForm class. /// </summary> public AddWMSLayerForm(MapObjectHolder target) { InitializeComponent(); if (target.GetType() != typeof(mapObj)) throw new ApplicationException("Invalid object type."); this.map = target; this.target = target; UpdateControls(); }
public static void Main(string[] args) { Console.WriteLine(""); if (args.Length < 2) { usage(); } mapObj map = new mapObj(args[0]); Console.WriteLine("# Map layers " + map.numlayers + "; Map name = " + map.name); for (int i = 0; i < map.numlayers; i++) { Console.WriteLine("Layer [" + i + "] name: " + map.getLayer(i).name); } try { // Create the output format outputFormatObj of = new outputFormatObj("CAIRO/WINGDI", "cairowinGDI"); map.appendOutputFormat(of); map.selectOutputFormat("cairowinGDI"); Bitmap mapImage = new Bitmap(map.width, map.height, PixelFormat.Format32bppRgb); using (Graphics g = Graphics.FromImage(mapImage)) { IntPtr hdc = g.GetHdc(); try { // Attach the device to the outputformat for drawing of.attachDevice(hdc); // Drawing directly to the GDI context using (imageObj image = map.draw()) { }; } finally { of.attachDevice(IntPtr.Zero); g.ReleaseHdc(hdc); } } mapImage.Save(args[1]); } catch (Exception ex) { Console.WriteLine("\nMessage ---\n{0}", ex.Message); Console.WriteLine( "\nHelpLink ---\n{0}", ex.HelpLink); Console.WriteLine("\nSource ---\n{0}", ex.Source); Console.WriteLine( "\nStackTrace ---\n{0}", ex.StackTrace); Console.WriteLine( "\nTargetSite ---\n{0}", ex.TargetSite); } }
public TileManagerForm(MainForm mainFormRef, string mapfile, MapControl mapobject) { InitializeComponent(); // references from main form mainForm = mainFormRef; mapfilepath = mapfile; mapControl = mapobject; map = mapControl.map; }
public void testGetLayerObj() { mapObj map = new mapObj(mapfile); layerObj newLayer = map.getLayer(1); map = null; gc(); assertNotNull(newLayer.map, "testGetLayerObj"); assert(newLayer.refcount == 2, "testGetLayerObj refcount"); }
public void testGetLayerObjByName() { mapObj map = new mapObj(mapfile); layerObj newLayer = map.getLayerByName("POLYGON"); map = null; gc(); assertNotNull(newLayer.map, "testGetLayerObjByName"); assert(newLayer.refcount == 2, "testGetLayerObjByName refcount"); }
public void testreferenceMapObj() { mapObj map = new mapObj(mapfile); referenceMapObj refmap = map.reference; refmap.markername = "This is a sample!"; map = null; gc(); assert(refmap.markername == "This is a sample!", "testreferenceMapObj"); }
public void testlegendObj() { mapObj map = new mapObj(mapfile); legendObj legend = map.legend; legend.template = "This is a sample!"; map = null; gc(); assert(legend.template == "This is a sample!", "testlegendObj"); }
internal static HandleRef getCPtrAndSetReference(mapObj obj, object parent) { if (obj != null) { obj.swigParentRef = parent; return obj.swigCPtr; } else { return new HandleRef(null, IntPtr.Zero); } }
public void testwebObj() { mapObj map = new mapObj(mapfile); webObj web = map.web; web.template = "This is a sample!"; map = null; gc(); assert(web.template == "This is a sample!", "testwebObj"); }
public void testqueryMapObj() { mapObj map = new mapObj(mapfile); queryMapObj querymap = map.querymap; querymap.color.setHex("#13ba88"); map = null; gc(); assert(querymap.color.toHex() == "#13ba88", "testqueryMapObj"); }
public void testGetClassObj() { mapObj map = new mapObj(mapfile); layerObj layer = map.getLayer(1); classObj newClass = layer.getClass(0); map = null; layer = null; gc(); assertNotNull(newClass.layer, "testGetClassObj"); assert(newClass.refcount == 2, "testGetClassObj refcount"); }
/// <summary> /// Constructs a new AddWMSLayerForm class. /// </summary> public AddWMSLayerForm(MapObjectHolder target) { InitializeComponent(); if (target.GetType() != typeof(mapObj)) { throw new ApplicationException("Invalid object type."); } this.map = target; this.target = target; UpdateControls(); }
public void testGetStyleObj() { mapObj map = new mapObj(mapfile); layerObj layer = map.getLayer(1); classObj classobj = layer.getClass(0); styleObj style = classobj.getStyle(0); map = null; layer = null; classobj = null; gc(); assert(style.refcount == 2, "testGetStyleObj"); }
public void testGetLayerObjByNameDestroy() { mapObj map = new mapObj(mapfile); layerObj newLayer = map.getLayerByName("POLYGON"); layerObj reference = map.getLayerByName("POLYGON"); assert(newLayer.refcount == 3, "testGetLayerObjByNameDestroy precondition"); //newLayer.Dispose(); // force the destruction needed for Mono on Windows newLayer = null; gc(); assert(reference.refcount == 2, "testGetLayerObjByNameDestroy"); }
public void testmapObjHashTable() { mapObj map = new mapObj(mapfile); hashTableObj configoptions = map.configoptions; configoptions.set("key", "test value"); map = null; gc(); assert(configoptions.get("key", "") == "test value", "testmapObjHashTable"); }
public void testsymbolSetObj() { mapObj map = new mapObj(mapfile); symbolSetObj symbolset = map.symbolset; symbolset.filename = "filename"; map = null; gc(); assert(symbolset.filename == "filename", "testsymbolSetObj"); }
internal static HandleRef getCPtrAndDisown(mapObj obj, object parent) { if (obj != null) { obj.swigCMemOwn = false; obj.swigParentRef = parent; return obj.swigCPtr; } else { return new HandleRef(null, IntPtr.Zero); } }
public void testInsertLayerObj() { mapObj map = new mapObj(mapfile); layerObj newLayer = new layerObj(null); map.insertLayer(newLayer, -1); map = null; gc(); assertNotNull(newLayer.map, "testInsertLayerObj"); assert(newLayer.refcount == 2, "testInsertLayerObj refcount"); }
public void testLayerObjDestroy() { mapObj map = new mapObj(mapfile); layerObj newLayer = new layerObj(map); layerObj reference = map.getLayer(map.numlayers - 1); assert(newLayer.refcount == 3, "testLayerObjDestroy precondition"); newLayer.Dispose(); // force the destruction for Mono on Windows because of the constructor overload newLayer = null; gc(); assert(reference.refcount == 2, "testLayerObjDestroy"); }
public void testGetClassObjDestroy() { mapObj map = new mapObj(mapfile); layerObj layer = map.getLayer(1); classObj newClass = layer.getClass(0); classObj reference = layer.getClass(0); assert(newClass.refcount == 3, "testGetClassObjDestroy precondition"); map = null; layer = null; newClass = null; gc(); assert(reference.refcount == 2, "testGetClassObjDestroy"); }
public void testimageObj() { mapObj map = new mapObj(mapfile); imageObj image = map.draw(); outputFormatObj format = image.format; format.setOption("INTERLACE", "OFF"); map = null; gc(); assert(format.getOption("INTERLACE", "") == "OFF", "testimageObj"); }
/// <summary> /// Constructs a new ChangeViewForm class. /// </summary> public StyleLibraryForm(MapObjectHolder target) { InitializeComponent(); isTextValidating = false; refresh = new RefreshDelegate(this.Refresh); isInit = true; isInitStyleLibText = true; // saving the reference to the base mapObj // In certain cases we require to reload the modified symbolset on the base mapfile too. this.target = target; this.map = target; }
public void testRemoveLayerObj() { mapObj map = new mapObj(mapfile); layerObj newLayer = new layerObj(null); map.insertLayer(newLayer, 0); map.removeLayer(0); map = null; gc(); assert(newLayer.refcount == 1, "testRemoveLayerObj"); }
public static void Main(string[] args) { Console.WriteLine(""); if (args.Length < 2) { usage(); } mapObj map = new mapObj(args[0]); Console.WriteLine("# Map layers " + map.numlayers + "; Map name = " + map.name); for (int i = 0; i < map.numlayers; i++) { Console.WriteLine("Layer [" + i + "] name: " + map.getLayer(i).name); } try { Bitmap mapImage = new Bitmap(map.width, map.height, PixelFormat.Format32bppRgb); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); using (imageObj image = map.draw()) { BitmapData bitmapData = mapImage.LockBits(new Rectangle(0, 0, image.width, image.height), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb); try { if (image.getRawPixels(bitmapData.Scan0) == (int)MS_RETURN_VALUE.MS_FAILURE) { Console.WriteLine("Unable to get image contents"); } } finally { mapImage.UnlockBits(bitmapData); } Console.WriteLine("Rendering time: " + stopwatch.ElapsedMilliseconds + "ms"); mapImage.Save(args[1]); } } catch (Exception ex) { Console.WriteLine("\nMessage ---\n{0}", ex.Message); Console.WriteLine( "\nHelpLink ---\n{0}", ex.HelpLink); Console.WriteLine("\nSource ---\n{0}", ex.Source); Console.WriteLine( "\nStackTrace ---\n{0}", ex.StackTrace); Console.WriteLine( "\nTargetSite ---\n{0}", ex.TargetSite); } }
public static void QueryByAttribute(string qstring, mapObj map, bool zoomToResults) { Console.WriteLine("\nPerforming QueryByAttribute:"); try { layerObj layer; rectObj query_bounds = null; for (int i = 0; i < map.numlayers; i++) { layer = map.getLayer(i); if (layer.connection != null && IsLayerQueryable(layer)) { Console.WriteLine("Layer [" + i + "] name: " + layer.name); BuildQuery(layer, qstring); // zoom to the query results using (resultCacheObj results = layer.getResults()) { if (results != null && results.numresults > 0) { // calculating the extent of the results if (query_bounds == null) query_bounds = new rectObj(results.bounds.minx, results.bounds.miny, results.bounds.maxx, results.bounds.maxy,0); else { if (results.bounds.minx < query_bounds.minx) query_bounds.minx = results.bounds.minx; if (results.bounds.miny < query_bounds.miny) query_bounds.miny = results.bounds.miny; if (results.bounds.maxx > query_bounds.maxx) query_bounds.maxx = results.bounds.maxx; if (results.bounds.maxy > query_bounds.maxy) query_bounds.maxy = results.bounds.maxy; } } } } } // setting the map extent to the result bounds if (query_bounds != null) { if (zoomToResults) { map.setExtent(query_bounds.minx, query_bounds.miny, query_bounds.maxx, query_bounds.maxy); map.scaleExtent(1.2, 0, 0); // increasing the visible area Console.WriteLine("Current map scale: 1:" + (int)map.scaledenom); } } else Console.WriteLine("The query returned 0 results ..."); } catch (Exception e) { Console.WriteLine("QueryByAttribute: " + e.Message); } }
public static void Main(string[] args) { Console.WriteLine(""); if (args.Length < 2) usage(); mapObj map = new mapObj(args[0]); Console.WriteLine("# Map layers " + map.numlayers + "; Map name = " + map.name); for (int i = 0; i < map.numlayers; i++) { Console.WriteLine("Layer [" + i + "] name: " + map.getLayer(i).name); } try { // Create the output format outputFormatObj of = new outputFormatObj("CAIRO/WINGDI", "cairowinGDI"); map.appendOutputFormat(of); map.selectOutputFormat("cairowinGDI"); Bitmap mapImage = new Bitmap(map.width, map.height, PixelFormat.Format32bppRgb); using (Graphics g = Graphics.FromImage(mapImage)) { IntPtr hdc = g.GetHdc(); try { // Attach the device to the outputformat for drawing of.attachDevice(hdc); // Drawing directly to the GDI context using (imageObj image = map.draw()) { }; } finally { of.attachDevice(IntPtr.Zero); g.ReleaseHdc(hdc); } } mapImage.Save(args[1]); } catch (Exception ex) { Console.WriteLine( "\nMessage ---\n{0}", ex.Message ); Console.WriteLine( "\nHelpLink ---\n{0}", ex.HelpLink ); Console.WriteLine( "\nSource ---\n{0}", ex.Source ); Console.WriteLine( "\nStackTrace ---\n{0}", ex.StackTrace ); Console.WriteLine( "\nTargetSite ---\n{0}", ex.TargetSite ); } }
public static void Main(string[] args) { Console.WriteLine(""); if (args.Length < 2) usage(); mapObj map = new mapObj(args[0]); Console.WriteLine("# Map layers " + map.numlayers + "; Map name = " + map.name); for (int i = 0; i < map.numlayers; i++) { Console.WriteLine("Layer [" + i + "] name: " + map.getLayer(i).name); } try { Bitmap mapImage = new Bitmap(map.width, map.height, PixelFormat.Format32bppRgb); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); using (imageObj image = map.draw()) { BitmapData bitmapData = mapImage.LockBits(new Rectangle(0, 0, image.width, image.height), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb); try { if (image.getRawPixels(bitmapData.Scan0) == (int)MS_RETURN_VALUE.MS_FAILURE) { Console.WriteLine("Unable to get image contents"); } } finally { mapImage.UnlockBits(bitmapData); } Console.WriteLine("Rendering time: " + stopwatch.ElapsedMilliseconds + "ms"); mapImage.Save(args[1]); } } catch (Exception ex) { Console.WriteLine( "\nMessage ---\n{0}", ex.Message ); Console.WriteLine( "\nHelpLink ---\n{0}", ex.HelpLink ); Console.WriteLine( "\nSource ---\n{0}", ex.Source ); Console.WriteLine( "\nStackTrace ---\n{0}", ex.StackTrace ); Console.WriteLine( "\nTargetSite ---\n{0}", ex.TargetSite ); } }
public static void Main(string[] args) { if (args.Length < 3) usage(); mapObj map = new mapObj(args[0]); map.legend.template = args[1]; map.web.imagepath = args[2]; map.web.imageurl = ""; string str = null; string[] names = null, values = null; names = new string[] {"map"}; values = new string[] { args[0] }; str = map.processLegendTemplate(names, values); Console.Write(str); }
public LabelEditorDialog(classObj inClass, mapObj map) : this(inClass) { m_pMap = map; if(m_pMap != null) { //add all the font int fontlist to the combox hashTableObj pFontList = m_pMap.fontset.fonts; string value = pFontList.nextKey(null); while(value != null) { comboBoxFont.Items.Add(value); value = pFontList.nextKey(value); } } }
public static void Main(string[] args) { Console.WriteLine(""); if (args.Length < 2) usage(); mapObj m_obj = new mapObj(args[0]); if (args.Length >= 3) { Console.WriteLine("Setting the imagetype to " + args[2]); m_obj.setImageType(args[2]); } Console.WriteLine ("# Map layers " + m_obj.numlayers + "; Map name = " + m_obj.name); for (int i=0; i<m_obj.numlayers; i++) { Console.WriteLine("Layer [" + i + "] name: " + m_obj.getLayer(i).name); } imageObj i_obj = m_obj.draw(); Console.WriteLine("Image URL = " + i_obj.imageurl + "; Image path = " + i_obj.imagepath); Console.WriteLine("Image height = " + i_obj.height + "; width = " + i_obj.width); try { i_obj.save(args[1],m_obj); } catch (Exception ex) { Console.WriteLine( "\nMessage ---\n{0}", ex.Message ); Console.WriteLine( "\nHelpLink ---\n{0}", ex.HelpLink ); Console.WriteLine( "\nSource ---\n{0}", ex.Source ); Console.WriteLine( "\nStackTrace ---\n{0}", ex.StackTrace ); Console.WriteLine( "\nTargetSite ---\n{0}", ex.TargetSite ); } }
public void testRemoveClassObj() { mapObj map=new mapObj(mapfile); layerObj layer=map.getLayer(1); classObj newClass=new classObj(null); layer.insertClass(newClass,0); layer.removeClass(0); map=null; layer=null; gc(); assert(newClass.refcount == 1, "testRemoveClassObj"); }
public void testGetStyleObjDestroy() { mapObj map=new mapObj(mapfile); layerObj layer=map.getLayer(1); classObj classobj=layer.getClass(0); styleObj style=classobj.getStyle(0); styleObj reference=classobj.getStyle(0); assert(style.refcount == 3, "testGetStyleObjDestroy precondition"); map=null; layer=null; classobj=null; style=null; gc(); assert(reference.refcount == 2, "testGetStyleObjDestroy"); }
public void testGetStyleObj() { mapObj map=new mapObj(mapfile); layerObj layer=map.getLayer(1); classObj classobj=layer.getClass(0); styleObj style=classobj.getStyle(0); map=null; layer=null; classobj=null; gc(); assert(style.refcount == 2, "testGetStyleObj"); }
public void testGetClassObjDestroy() { mapObj map=new mapObj(mapfile); layerObj layer=map.getLayer(1); classObj newClass=layer.getClass(0); classObj reference = layer.getClass(0); assert(newClass.refcount == 3, "testGetClassObjDestroy precondition"); map=null; layer=null; newClass=null; gc(); assert(reference.refcount == 2, "testGetClassObjDestroy"); }
public void testGetClassObj() { mapObj map=new mapObj(mapfile); layerObj layer=map.getLayer(1); classObj newClass=layer.getClass(0); map=null; layer=null; gc(); assertNotNull(newClass.layer, "testGetClassObj"); assert(newClass.refcount == 2, "testGetClassObj refcount"); }
public void testInsertStyleObjDestroy() { mapObj map=new mapObj(mapfile); layerObj layer=map.getLayer(1); classObj classobj=layer.getClass(0); styleObj newStyle = new styleObj(null); classobj.insertStyle(newStyle,0); styleObj reference = classobj.getStyle(0); assert(newStyle.refcount == 3, "testInsertStyleObjDestroy precondition"); newStyle.Dispose(); // force the destruction for Mono on Windows because of the constructor overload map=null; layer=null; classobj=null; newStyle=null; gc(); assert(reference.refcount == 2, "testInsertStyleObjDestroy"); }
public void testRemoveStyleObj() { mapObj map=new mapObj(mapfile); layerObj layer=map.getLayer(1); classObj classobj=layer.getClass(0); styleObj newStyle = new styleObj(null); classobj.insertStyle(newStyle,0); classobj.removeStyle(0); map=null; layer=null; classobj=null; gc(); assert(newStyle.refcount == 1, "testRemoveStyleObj"); }
public void testInsertStyleObj() { mapObj map=new mapObj(mapfile); layerObj layer=map.getLayer(1); classObj classobj=layer.getClass(0); styleObj newStyle = new styleObj(null); classobj.insertStyle(newStyle,-1); assert(newStyle.refcount == 2, "testInsertStyleObj precondition"); map=null; layer=null; classobj=null; gc(); assert(newStyle.refcount == 2, "testInsertStyleObj"); }
public void testInsertClassObj() { mapObj map=new mapObj(mapfile); layerObj layer=map.getLayer(1); classObj newClass=new classObj(null); layer.insertClass(newClass,-1); assertNotNull(newClass.layer, "testInsertClassObj precondition"); map=null; layer=null; gc(); assertNotNull(newClass.layer, "testInsertClassObj"); assert(newClass.refcount == 2, "testInsertClassObj refcount"); }
public void testClassObjDestroy() { mapObj map=new mapObj(mapfile); layerObj layer=map.getLayer(1); classObj newClass=new classObj(layer); classObj reference=layer.getClass(layer.numclasses-1); assert(newClass.refcount == 3, "testClassObjDestroy precondition"); newClass.Dispose(); // force the destruction for Mono on Windows because of the constructor overload map=null; layer=null; newClass=null; gc(); assert(reference.refcount == 2, "testClassObjDestroy"); }
public void testGetLayerObjByNameDestroy() { mapObj map=new mapObj(mapfile); layerObj newLayer=map.getLayerByName("POLYGON"); layerObj reference=map.getLayerByName("POLYGON"); assert(newLayer.refcount == 3, "testGetLayerObjByNameDestroy precondition"); //newLayer.Dispose(); // force the destruction needed for Mono on Windows newLayer=null; gc(); assert(reference.refcount == 2, "testGetLayerObjByNameDestroy"); }
public void testGetLayerObjByName() { mapObj map=new mapObj(mapfile); layerObj newLayer=map.getLayerByName("POLYGON"); map=null; gc(); assertNotNull(newLayer.map, "testGetLayerObjByName"); assert(newLayer.refcount == 2, "testGetLayerObjByName refcount"); }
public void testGetLayerObj() { mapObj map=new mapObj(mapfile); layerObj newLayer=map.getLayer(1); map=null; gc(); assertNotNull(newLayer.map, "testGetLayerObj"); assert(newLayer.refcount == 2, "testGetLayerObj refcount"); }
public static void Main(string[] args) { Console.WriteLine(""); if (args.Length < 2) usage(); map = new mapObj(args[0]); Console.WriteLine("# Map layers " + map.numlayers + "; Map name = " + map.name); for (int i = 0; i < map.numlayers; i++) { Console.WriteLine("Layer [" + i + "] name: " + map.getLayer(i).name); } try { PrintDocument doc = new PrintDocument(); doc.PrintPage += new PrintPageEventHandler(doc_PrintPage); // Specify the printer to use. doc.PrinterSettings.PrinterName = args[1]; doc.Print(); } catch (Exception ex) { Console.WriteLine( "\nMessage ---\n{0}", ex.Message ); Console.WriteLine( "\nHelpLink ---\n{0}", ex.HelpLink ); Console.WriteLine( "\nSource ---\n{0}", ex.Source ); Console.WriteLine( "\nStackTrace ---\n{0}", ex.StackTrace ); Console.WriteLine( "\nTargetSite ---\n{0}", ex.TargetSite ); } }