Example #1
0
        public Object createObject(IAdaptingType iAdaptingType)
        {
            if (iAdaptingType is NamedObject)
            {
                iAdaptingType = ((NamedObject)iAdaptingType).TypedObject;
            }

            if (iAdaptingType.GetType() == typeof(NullType))
            {
                return(null);
            }

            if (iAdaptingType is AnonymousObject)
            {
                Dictionary <object, object> properties = (Dictionary <object, object>)iAdaptingType.defaultAdapt();
                String geoJson = (String)properties["geoJson"];

                if (geoJson == null)
                {
                    return(null);
                }

                String   geomClass = (String)properties["geomClass"];
                int      srsId     = (int)properties["srsId"];
                Geometry geometry  = new GeometryDTO(geomClass, srsId, geoJson).ToGeometry <Geometry>();

                return(geometry);
            }
            else
            {
                throw new System.Exception("Unknown type");
            }
        }
Example #2
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }

            if (!(obj is GeometryDTO))
            {
                return(false);
            }

            GeometryDTO that = (GeometryDTO)obj;

            return(Object.Equals(geomClass, that.geomClass) && Object.Equals(srsId, that.srsId) &&
                   Object.Equals(geoJSON, that.geoJSON));
        }