/// <summary> /// Have the editor to update the theme on the layer object. /// </summary> public void UpdateValues() { if (newLayer != null) { // remove the auto style from this layer layer.styleitem = null; while (layer.numclasses > 0) { layer.removeClass(layer.numclasses - 1); } for (int i = 0; i < newLayer.numclasses; i++) { classObj classobj = newLayer.getClass(i).clone(); // bindings are not supported with sample maps for (int s = 0; s < classobj.numstyles; s++) { StyleBindingController.RemoveAllBindings(classobj.getStyle(s)); } for (int l = 0; l < classobj.numlabels; l++) { LabelBindingController.RemoveAllBindings(classobj.getLabel(l)); } layer.insertClass(classobj, -1); } if (target != null) { target.RaisePropertyChanged(this); } } }
/// <summary> /// Let the editor to update the modified values to the underlying object. /// </summary> public void UpdateValues() { if (label == null) { return; } if (dirtyFlag) { Update(this.label); labelBindingControllerFont.ApplyBinding(); labelBindingControllerAngle.ApplyBinding(); labelBindingControllerSize.ApplyBinding(); labelBindingControllerColor.ApplyBinding(); labelBindingControllerOutlineColor.ApplyBinding(); labelBindingControllerPosition.ApplyBinding(); labelBindingControllerPriority.ApplyBinding(); labelBindingControllerShadowSizeX.ApplyBinding(); labelBindingControllerShadowSizeY.ApplyBinding(); if (target != null) { target.RaisePropertyChanged(this); } SetDirty(false); isStyleChanged = false; } }
/// <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); } } }
/// <summary> /// Let the editor to update the modified values to the underlying object. /// </summary> public void UpdateValues() { if (classobj == null) { return; } if (dirtyFlag) { // general tab classobj.name = this.textBoxName.Text; classobj.title = this.textBoxTitle.Text; classobj.setExpression(this.textBoxExpression.Text); classobj.setText(this.textBoxText.Text); // display tab if (checkBoxVisible.CheckState == CheckState.Checked) { classobj.status = mapscript.MS_ON; } else { classobj.status = mapscript.MS_OFF; } if (checkBoxQueryable.CheckState == CheckState.Checked) { classobj.template = "query"; } else { classobj.template = null; } classobj.maxscaledenom = -1; classobj.minscaledenom = -1; if (textBoxMaxZoom.Text == "") { classobj.maxscaledenom = -1; } else { classobj.maxscaledenom = double.Parse(textBoxMaxZoom.Text); } if (textBoxMinZoom.Text == "") { classobj.minscaledenom = -1; } else { classobj.minscaledenom = double.Parse(textBoxMinZoom.Text); } if (target != null) { target.RaisePropertyChanged(this); } SetDirty(false); } }
/// <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 (scalebar == null) { return; } if (dirtyFlag) { Update(this.scalebar); if (target != null) { target.RaisePropertyChanged(this); } SetDirty(false); } }
/// <summary> /// Click event handler of the buttonApply control. /// </summary> /// <param name="sender">The source object of this event.</param> /// <param name="e">The event parameters.</param> private void buttonApply_Click(object sender, EventArgs e) { double deltaX = (map.extent.maxx - map.extent.minx) * zoomFactor / 2; double deltaY = (map.extent.maxy - map.extent.miny) * zoomFactor / 2; double centerX = double.Parse(textBoxX.Text); double centerY = double.Parse(textBoxY.Text); map.setExtent(centerX - deltaX, centerY - deltaY, centerX + deltaX, centerY + deltaY); target.RaisePropertyChanged(this); double zoom = (map.extent.maxx - map.extent.minx); if (mapunits != map.units) { zoom = zoom * MapUtils.InchesPerUnit(map.units) / MapUtils.InchesPerUnit(mapunits); } target.RaiseZoomChanged(this, Math.Round(zoom, unitPrecision), map.scaledenom); zoomFactor = 1.0; }
/// <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); if (classobj != null && style.symbolname != null) { classobj.name = style.symbolname; } SetDirty(false); if (target != null) { target.RaisePropertyChanged(this); } } }
private void toolStripButton1_Click(object sender, EventArgs e) { Compile(textBoxScript.Text); mapH.RaisePropertyChanged(this); }
/// <summary> /// Let the editor to update the modified values to the underlying object. /// </summary> public void UpdateValues() { if (map == null) { return; } if (dirtyFlag) { dirtyFlag = false; // general tab if (map.name != this.textBoxName.Text) { map.name = this.textBoxName.Text; } if (map.shapepath != this.textBoxShapePath.Text) { map.shapepath = this.textBoxShapePath.Text; } if (map.web.imagepath != this.textBoxImagepath.Text) { map.web.imagepath = this.textBoxImagepath.Text; } if (map.fontset.filename != this.textBoxFontset.Text) { if (this.textBoxFontset.Text != "" && File.Exists(this.textBoxFontset.Text)) { map.setFontSet(this.textBoxFontset.Text); } else { map.setFontSet(null); } } if (map.symbolset.filename != this.textBoxSymbolset.Text) { if (this.textBoxSymbolset.Text != "" && File.Exists(this.textBoxSymbolset.Text)) { try { map.setSymbolSet(this.textBoxSymbolset.Text); } catch (Exception ex) { MessageBox.Show("Invalid symbol file, " + ex.Message, "MapManager", MessageBoxButtons.OK, MessageBoxIcon.Error); map.setSymbolSet(null); } } else { map.setSymbolSet(null); } } // image details tab this.colorPickerBackColor.ApplyTo(map.imagecolor); if (map.imagetype != comboBoxImageType.Text) { map.selectOutputFormat(comboBoxImageType.Text); } map.resolution = Convert.ToDouble(this.textBoxResolution.Text); // coordinate space // need to recalculate the extent to point to the same visible area try { // setting up the projection if it have been changed if (map.getProjection() != this.textBoxProjection.Tag.ToString()) { if (map.getProjection() != "" && this.textBoxProjection.Tag.ToString() != "" && map.extent.minx < map.extent.maxx && map.extent.miny < map.extent.maxy) { using (projectionObj oldProj = new projectionObj(map.getProjection())) { using (projectionObj newProj = new projectionObj(this.textBoxProjection.Tag.ToString())) { using (rectObj rect = new rectObj(map.extent.minx, map.extent.miny, map.extent.maxx, map.extent.maxy, 0)) { rect.project(oldProj, newProj); map.units = (MS_UNITS)this.comboBoxUnits.SelectedItem; if (rect.minx < rect.maxx && rect.miny < rect.maxy) { map.setExtent(rect.minx, rect.miny, rect.maxx, rect.maxy); dirtyFlagExtent = true; UpdateExtentValues(); } } } } } if (this.textBoxProjection.Tag.ToString().Trim().StartsWith("+")) { map.setProjection(this.textBoxProjection.Tag.ToString()); map.setMetaData("coordsys_name", this.textBoxProjection.Text); } else { map.setProjection("+AUTO"); } } } catch (Exception ex) { MessageBox.Show("Unable to set projection value, " + ex.Message, "MapManager", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (checkBoxTransparent.Checked) { map.outputformat.transparent = mapscript.MS_TRUE; if (map.outputformat.imagemode == (int)MS_IMAGEMODE.MS_IMAGEMODE_RGB) { map.outputformat.imagemode = (int)MS_IMAGEMODE.MS_IMAGEMODE_RGBA; } } else { map.outputformat.transparent = mapscript.MS_FALSE; if (map.outputformat.imagemode == (int)MS_IMAGEMODE.MS_IMAGEMODE_RGBA) { map.outputformat.imagemode = (int)MS_IMAGEMODE.MS_IMAGEMODE_RGB; } } if (target != null && !dirtyFlagExtent) { target.RaisePropertyChanged(this); } SetDirty(false); } if (dirtyFlagExtent) { ApplyExtent(); dirtyFlagExtent = false; } }