private void OnMultiLineWidthSelectionChanged(LineWidth selected) { isChangingMultipleAttributes = true; using (frame.Project.Undo.UndoFrame) { for (int i = 0; i < selectedObjects.Count; ++i) { ILineWidth ilw = selectedObjects[i] as ILineWidth; if (ilw != null) { ilw.LineWidth = selected; } } } isChangingMultipleAttributes = false; MultiChangeDone(); }
public LineWidthSelectionProperty(string ResourceId, LineWidthList lineWidthList, ILineWidth iLineWidth, bool includeUndefined) { this.lineWidthList = lineWidthList; resourceId = ResourceId; LineWidth select = iLineWidth.LineWidth; if (includeUndefined) { choices = new string[lineWidthList.Count + 1]; for (int i = 0; i < lineWidthList.Count; ++i) { choices[i + 1] = lineWidthList[i].Name; } string undef = StringTable.GetString("LineWidth.Undefined"); // sollte es den Namen schon geben, werden solange - davor und dahintergemacht, bis es den Namen mehr gibt while (lineWidthList.Find(undef) != null) { undef = "-" + undef + "-"; } choices[0] = undef; if (select != null) { base.selectedText = select.Name; } else { base.selectedText = undef; } } else { choices = new string[lineWidthList.Count]; for (int i = 0; i < lineWidthList.Count; ++i) { choices[i] = lineWidthList[i].Name; } if (select != null) { base.selectedText = select.Name; } } this.iLineWidth = iLineWidth; toWatch = iLineWidth as IGeoObject; }
/// <summary> /// Checks whether an <see cref="IGeoObject"/> is accepted by this filter. /// To realize custom filters, override this method. /// </summary> /// <param name="go">The object beeing tested</param> /// <returns>true if accepted, fale otherwise</returns> public virtual bool Accept(IGeoObject go) { // jetzt so implementiert: wenn ein Attribut verlangt wird und ein Objekt nicht das // passende Interface hat, dann wird es nicht akzeptiert // wenn z.B. der Layer eines Objektes null ist, dann wird dieses von keinem Filter anerkannt if (acceptedLayers.Count > 0) { ILayer ilayer = go as ILayer; if (ilayer == null) { return(false); } if (ilayer.Layer == null) { return(false); } if (!acceptedLayers.ContainsKey(ilayer.Layer)) { return(false); } } if (acceptedColorDefs.Count > 0) { IColorDef iColorDef = go as IColorDef; if (iColorDef == null) { return(false); } if (iColorDef.ColorDef == null) { return(false); } if (!acceptedColorDefs.ContainsKey(iColorDef.ColorDef)) { return(false); } } if (acceptedLineWidths.Count > 0) { ILineWidth iLineWidth = go as ILineWidth; if (iLineWidth == null) { return(false); } if (iLineWidth.LineWidth == null) { return(false); } if (!acceptedLineWidths.ContainsKey(iLineWidth.LineWidth)) { return(false); } } if (acceptedLinePatterns.Count > 0) { ILinePattern iLinePattern = go as ILinePattern; if (iLinePattern == null) { return(false); } if (iLinePattern.LinePattern == null) { return(false); } if (!acceptedLinePatterns.ContainsKey(iLinePattern.LinePattern)) { return(false); } } if (acceptedDimensionStyles.Count > 0) { IDimensionStyle iDimensionStyle = go as IDimensionStyle; if (iDimensionStyle == null) { return(false); } if (iDimensionStyle.DimensionStyle == null) { return(false); } if (!acceptedDimensionStyles.ContainsKey(iDimensionStyle.DimensionStyle)) { return(false); } } if (acceptedHatchStyles.Count > 0) { IHatchStyle iHatchStyle = go as IHatchStyle; if (iHatchStyle == null) { return(false); } if (iHatchStyle.HatchStyle == null) { return(false); } if (!acceptedHatchStyles.ContainsKey(iHatchStyle.HatchStyle)) { return(false); } } if (acceptedTypes.Count > 0) { if (!acceptedTypes.ContainsKey(go.GetType())) { return(false); } } return(true); }
public void InitMultiAttributeSelection() { if (multiLinePattern == null) { return; } LinePattern commonLinePattern = null; bool linePatternValid = true; for (int i = 0; i < selectedObjects.Count; ++i) { ILinePattern ilp = selectedObjects[i] as ILinePattern; if (linePatternValid && ilp != null) { if (commonLinePattern == null) { commonLinePattern = ilp.LinePattern; } else { linePatternValid = (ilp.LinePattern != null) && (commonLinePattern == ilp.LinePattern); } } } if (linePatternValid && commonLinePattern != null) { multiLinePattern.SetSelection(frame.Project.LinePatternList.FindIndex(commonLinePattern)); } else { multiLinePattern.SetSelection(-1); } LineWidth commonLineWidth = null; bool lineWidthValid = true; for (int i = 0; i < selectedObjects.Count; ++i) { ILineWidth ilp = selectedObjects[i] as ILineWidth; if (lineWidthValid && ilp != null) { if (commonLineWidth == null) { commonLineWidth = ilp.LineWidth; } else { lineWidthValid = (ilp.LineWidth != null) && (commonLineWidth == ilp.LineWidth); } } } if (lineWidthValid && commonLineWidth != null) { multiLineWidth.SetSelection(frame.Project.LineWidthList.FindIndex(commonLineWidth)); } else { multiLineWidth.SetSelection(-1); } Layer commonLayer = null; bool LayerValid = true; for (int i = 0; i < selectedObjects.Count; ++i) { ILayer ily = selectedObjects[i] as ILayer; if (LayerValid && ily != null) { if (commonLayer == null) { commonLayer = ily.Layer; } else { LayerValid = (ily.Layer != null) && (commonLayer == ily.Layer); } } } if (LayerValid && commonLayer != null) { multiLayer.SetSelection(frame.Project.LayerList.FindIndex(commonLayer)); } else { multiLayer.SetSelection(-1); } ColorDef commonColorDef = null; bool ColorDefValid = true; for (int i = 0; i < selectedObjects.Count; ++i) { IColorDef ily = selectedObjects[i] as IColorDef; if (ColorDefValid && ily != null) { if (commonColorDef == null) { commonColorDef = ily.ColorDef; } else { ColorDefValid = (ily.ColorDef != null) && (commonColorDef == ily.ColorDef); } } } if (ColorDefValid && commonColorDef != null) { multiColorDef.SetSelection(frame.Project.ColorList.FindIndex(commonColorDef)); } else { multiColorDef.SetSelection(-1); } Style commonStyle = null; bool StyleValid = true; for (int i = 0; i < selectedObjects.Count; ++i) { IStyle ily = selectedObjects[i] as IStyle; if (StyleValid && ily != null) { if (commonStyle == null) { commonStyle = ily.Style; } else { StyleValid = (ily.Style != null) && (commonStyle == ily.Style); } } } if (StyleValid && commonStyle != null) { multiStyle.SetSelection(frame.Project.StyleList.FindIndex(commonStyle)); } else { multiStyle.SetSelection(-1); } }