/// <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); }