/// <summary> /// Click event handler of the buttonAddStyle control /// </summary> /// <param name="sender">The source object of this event.</param> /// <param name="e">The event parameters.</param> private void buttonAddStyle_Click(object sender, EventArgs e) { styleObj style = new styleObj(null); style.setGeomTransform("labelpnt"); style.color = new colorObj(0, 0, 0, 255); style.size = 8; AddStyleToList(style); isStyleChanged = true; UpdatePreview(); }
/// <summary> /// Update the style object according to the current Editor state. /// </summary> /// <param name="style">The object to be updated.</param> private void Update(styleObj style) { // general tab style.size = double.Parse(textBoxSize.Text); styleBindingControllerSize.ApplyBinding(); style.minsize = double.Parse(textBoxMinSize.Text); style.maxsize = double.Parse(textBoxMaxSize.Text); style.width = double.Parse(textBoxWidth.Text); styleBindingControllerWidth.ApplyBinding(); style.angle = double.Parse(textBoxAngle.Text); styleBindingControllerAngle.ApplyBinding(); style.minwidth = double.Parse(textBoxMinWidth.Text); style.maxwidth = double.Parse(textBoxMaxWidth.Text); // display tab this.colorPickerColor.ApplyTo(style.color); styleBindingControllerColor.ApplyBinding(); this.colorPickerBackColor.ApplyTo(style.backgroundcolor); this.colorPickerOutlineColor.ApplyTo(style.outlinecolor); styleBindingControllerOutlineColor.ApplyBinding(); style.offsetx = int.Parse(textBoxOffsetX.Text); style.offsety = int.Parse(textBoxOffsetY.Text); style.opacity = trackBarOpacity.Value; // set up alpha values according to opacity int alpha = Convert.ToInt32(style.opacity * 2.55); style.color.alpha = alpha; style.outlinecolor.alpha = alpha; style.backgroundcolor.alpha = alpha; style.mincolor.alpha = alpha; style.maxcolor.alpha = alpha; if (checkBoxAntialias.Checked) style.antialias = mapscript.MS_TRUE; else style.antialias = mapscript.MS_FALSE; if (checkBoxAutoAngle.Checked) style.autoangle = mapscript.MS_TRUE; else style.autoangle = mapscript.MS_FALSE; if (comboBoxGeomTransform.Text != "") style.setGeomTransform(comboBoxGeomTransform.Text); else style.setGeomTransform(null); style.gap = double.Parse(textBoxGap.Text); string[] values = textBoxPattern.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (values.Length > 0) { double[] result = new double[values.Length]; for (int i = 0; i < values.Length; i++) result[i] = double.Parse(values[i], ni); style.pattern = result; } else style.patternlength = 0; if (textBoxMaxZoom.Text == "") style.maxscaledenom = -1; else style.maxscaledenom = double.Parse(textBoxMaxZoom.Text); if (textBoxMinZoom.Text == "") style.minscaledenom = -1; else style.minscaledenom = double.Parse(textBoxMinZoom.Text); }
/// <summary> /// Update the style object according to the current Editor state. /// </summary> /// <param name="style">The object to be updated.</param> private void Update(styleObj style) { // general tab style.size = double.Parse(textBoxSize.Text); styleBindingControllerSize.ApplyBinding(); style.minsize = double.Parse(textBoxMinSize.Text); style.maxsize = double.Parse(textBoxMaxSize.Text); style.width = double.Parse(textBoxWidth.Text); styleBindingControllerWidth.ApplyBinding(); style.angle = double.Parse(textBoxAngle.Text); styleBindingControllerAngle.ApplyBinding(); style.minwidth = double.Parse(textBoxMinWidth.Text); style.maxwidth = double.Parse(textBoxMaxWidth.Text); // display tab this.colorPickerColor.ApplyTo(style.color); styleBindingControllerColor.ApplyBinding(); this.colorPickerBackColor.ApplyTo(style.backgroundcolor); this.colorPickerOutlineColor.ApplyTo(style.outlinecolor); styleBindingControllerOutlineColor.ApplyBinding(); style.offsetx = int.Parse(textBoxOffsetX.Text); style.offsety = int.Parse(textBoxOffsetY.Text); style.opacity = trackBarOpacity.Value; // set up alpha values according to opacity int alpha = Convert.ToInt32(style.opacity * 2.55); style.color.alpha = alpha; style.outlinecolor.alpha = alpha; style.backgroundcolor.alpha = alpha; style.mincolor.alpha = alpha; style.maxcolor.alpha = alpha; if (checkBoxAntialias.Checked) { style.antialias = mapscript.MS_TRUE; } else { style.antialias = mapscript.MS_FALSE; } if (checkBoxAutoAngle.Checked) { style.autoangle = mapscript.MS_TRUE; } else { style.autoangle = mapscript.MS_FALSE; } if (comboBoxGeomTransform.Text != "") { style.setGeomTransform(comboBoxGeomTransform.Text); } else { style.setGeomTransform(null); } style.gap = double.Parse(textBoxGap.Text); string[] values = textBoxPattern.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (values.Length > 0) { double[] result = new double[values.Length]; for (int i = 0; i < values.Length; i++) { result[i] = double.Parse(values[i], ni); } style.pattern = result; } else { style.patternlength = 0; } if (textBoxMaxZoom.Text == "") { style.maxscaledenom = -1; } else { style.maxscaledenom = double.Parse(textBoxMaxZoom.Text); } if (textBoxMinZoom.Text == "") { style.minscaledenom = -1; } else { style.minscaledenom = double.Parse(textBoxMinZoom.Text); } }
/// <summary> /// Click event handler of the buttonAddStyle control /// </summary> /// <param name="sender">The source object of this event.</param> /// <param name="e">The event parameters.</param> private void buttonAddStyle_Click(object sender, EventArgs e) { styleObj style = new styleObj(null); style.setGeomTransform("labelpnt"); style.color = new colorObj(0, 0, 0, 0); style.size = 8; AddStyleToList(style); isStyleChanged = true; UpdatePreview(); }