Beispiel #1
0
        public bool Visit(IShapedObject obj)
        {
            int batchLevel = (int)stat.batchLevel;

            switch (obj.ClassId)
            {
            case ClassId.Lib:
                GLib lib = (GLib)obj;
                stat.nBgImages += lib.BgImages.Count;
                stat.nLayers   += lib.Layers.Count;
                stat.nViews    += lib.Views.Count;
                return(batchLevel >= (int)BatchLevel.Type);

            case ClassId.Type:
                stat.nTypes++;
                return(true);

            case ClassId.Range:
                if (batchLevel < (int)BatchLevel.Range)
                {
                    return(false);
                }
                stat.nRanges++;
                return((int)stat.batchLevel >= (int)BatchLevel.Object);

            case ClassId.Object:
                stat.nObjects++;
                break;
            }
            return(false);
        }
Beispiel #2
0
 public void UpdateBounds(IShapedObject obj)
 {
     if (obj != null)
     {
         bounds.Update(obj.Bounds);
     }
 }
Beispiel #3
0
 public void Add(IShapedObject obj)
 {
     if (obj != null)
     {
         objects.Add(obj);
         UpdateBounds(obj);
     }
 }
Beispiel #4
0
        public void DataChanged(object obj)
        {
            ISerializableObject ser = obj as ISerializableObject;

            if (ser != null)
            {
                switch (ser.ClassId)
                {
                case ClassId.Lib:
                    if (lib.IsUpdated(LibField.Attr))
                    {
                        CheckMirrorChanged();
                    }
                    if (lib.IsUpdated(LibField.Name))
                    {
                        CheckCompositeNameChanged(lib);
                    }
                    break;

                case ClassId.Type:
                    GType type = (GType)obj;
                    if (lib.IsUpdated(LibField.Name))
                    {
                        CheckCompositeNameChanged(type);
                    }
                    break;

                case ClassId.BgImage:
                    mainForm.RepaintMapForms();
                    break;

                case ClassId.Layer:
                    UpdateControls();
                    break;

                default:
                    break;
                }
            }
            IShapedObject iobj = obj as IShapedObject;

            if (iobj != null)
            {
                CheckRepaint(iobj);
            }
            if (obj is Layers)
            {
                UpdateControls();
            }
            if (obj is Map)
            {
                UpdateControls();
            }
        }
Beispiel #5
0
        public bool Visit(IShapedObject obj)
        {
            bool visible = obj.IsVisibleOnMap(map);

            if (visible)
            {
                if (filter == null || filter.ContainsKey(obj.GetType().Name))
                {
                    list.Add(obj);
                }
            }
            return(visible);
        }
Beispiel #6
0
 public void Set(IShapedObject obj)
 {
     Clear();
     Add(obj);
 }
Beispiel #7
0
        public bool Visit(IShapedObject obj)
        {
            if (obj is GLib)
            {
                return(true);
            }

            if (obj is GComposite)
            {
                if (!Includes(obj.Id))
                {
                    return(false);
                }
                if (!((GComposite)obj).Contains(scale))
                {
                    return(false);
                }
            }

            Rect r = obj.Bounds;

            r.Inflate(dist);
            if (!Intersects(r))
            {
                return(false);
            }

            if (!(obj is GObject))
            {
                return(true);
            }

            switch (((GObject)obj).GeomType)
            {
            case GeomType.Polygon:
                if (((GPolygon)obj).Contains(point))
                {
                    objects.Add(obj);
                }
                break;

            case GeomType.Polyline:
                if (((GPolyline)obj).DistanceSq(point) < distSq)
                {
                    objects.Add(obj);
                }
                break;

            case GeomType.Point:
                if (((GPoint)obj).DistanceSq(point) < distSq)
                {
                    objects.Add(obj);
                }
                break;

            case GeomType.Caption:
                if (((GCaption)obj).DistanceSq(point) < distSq)
                {
                    objects.Add(obj);
                }
                break;
            }
            return(false);
        }