/// <summary> /// Creates a clone of the specified instance /// </summary> /// <param name="prop">The instance to clone.</param> /// <returns></returns> public static PropertyDefinition Clone(PropertyDefinition prop) { switch (prop.Type) { case PropertyDefinitionType.Data: { var source = (DataPropertyDefinition)prop; var dp = new DataPropertyDefinition(prop.Name, prop.Description); dp.DataType = source.DataType; dp.DefaultValue = source.DefaultValue; dp.IsAutoGenerated = source.IsAutoGenerated; dp.IsNullable = source.IsNullable; dp.IsReadOnly = source.IsReadOnly; dp.Length = source.Length; dp.Precision = source.Precision; dp.Scale = source.Scale; return(dp); } case PropertyDefinitionType.Geometry: { var source = (GeometricPropertyDefinition)prop; var gp = new GeometricPropertyDefinition(prop.Name, prop.Description); gp.SpecificGeometryTypes = source.SpecificGeometryTypes; gp.HasElevation = source.HasElevation; gp.HasMeasure = source.HasMeasure; gp.IsReadOnly = source.IsReadOnly; gp.SpatialContextAssociation = source.SpatialContextAssociation; return(gp); } case PropertyDefinitionType.Raster: { var source = (RasterPropertyDefinition)prop; var rp = new RasterPropertyDefinition(prop.Name, prop.Description); rp.DefaultImageXSize = source.DefaultImageXSize; rp.DefaultImageYSize = source.DefaultImageYSize; rp.IsNullable = source.IsNullable; rp.IsReadOnly = source.IsReadOnly; rp.SpatialContextAssociation = source.SpatialContextAssociation; return(rp); } } throw new ArgumentException(); }
/// <summary> /// Parses the specified XML node into a Property Definition /// </summary> /// <param name="node"></param> /// <param name="mgr"></param> /// <returns></returns> public static PropertyDefinition Parse(System.Xml.XmlNode node, System.Xml.XmlNamespaceManager mgr) { PropertyDefinition prop = null; var nn = node.Attributes["name"]; //NOXLATE var nulln = node.Attributes["minOccurs"]; //NOXLATE string name = Utility.DecodeFDOName(nn.Value); string desc = string.Empty; //Description var docNode = node.SelectSingleNode("xs:annotation/xs:documentation", mgr); //NOXLATE if (docNode != null) { desc = docNode.InnerText; } if (node.Attributes["type"] != null && node.Attributes["type"].Value == "gml:AbstractGeometryType") //NOXLATE { prop = new GeometricPropertyDefinition(name, desc); } else if (node["xs:simpleType"] == null) //NOXLATE { prop = new RasterPropertyDefinition(name, desc); } else { if (node["xs:simpleType"] != null) //NOXLATE { prop = new DataPropertyDefinition(name, desc); } } if (prop != null) { prop.ReadXml(node, mgr); } else { throw new NotSupportedException(Strings.ErrorUnsupporteFdoSchemaXml); } return(prop); }
/// <summary> /// Parses the specified XML node into a Property Definition /// </summary> /// <param name="node"></param> /// <param name="mgr"></param> /// <returns></returns> public static PropertyDefinition Parse(System.Xml.XmlNode node, System.Xml.XmlNamespaceManager mgr) { PropertyDefinition prop = null; var nn = node.Attributes["name"]; //NOXLATE var nulln = node.Attributes["minOccurs"]; //NOXLATE string name = Utility.DecodeFDOName(nn.Value); string desc = string.Empty; //Description var docNode = node.SelectSingleNode("xs:annotation/xs:documentation", mgr); //NOXLATE if (docNode != null) desc = docNode.InnerText; if (node.Attributes["type"] != null && node.Attributes["type"].Value == "gml:AbstractGeometryType") //NOXLATE { prop = new GeometricPropertyDefinition(name, desc); } else if (node["xs:simpleType"] == null) //NOXLATE { prop = new RasterPropertyDefinition(name, desc); } else { if (node["xs:simpleType"] != null) //NOXLATE prop = new DataPropertyDefinition(name, desc); } if (prop != null) prop.ReadXml(node, mgr); else throw new NotSupportedException(Strings.ErrorUnsupporteFdoSchemaXml); return prop; }
/// <summary> /// Creates a clone of the specified instance /// </summary> /// <param name="prop">The instance to clone.</param> /// <returns></returns> public static PropertyDefinition Clone(PropertyDefinition prop) { switch (prop.Type) { case PropertyDefinitionType.Data: { var source = (DataPropertyDefinition)prop; var dp = new DataPropertyDefinition(prop.Name, prop.Description); dp.DataType = source.DataType; dp.DefaultValue = source.DefaultValue; dp.IsAutoGenerated = source.IsAutoGenerated; dp.IsNullable = source.IsNullable; dp.IsReadOnly = source.IsReadOnly; dp.Length = source.Length; dp.Precision = source.Precision; dp.Scale = source.Scale; return dp; } case PropertyDefinitionType.Geometry: { var source = (GeometricPropertyDefinition)prop; var gp = new GeometricPropertyDefinition(prop.Name, prop.Description); gp.SpecificGeometryTypes = source.SpecificGeometryTypes; gp.HasElevation = source.HasElevation; gp.HasMeasure = source.HasMeasure; gp.IsReadOnly = source.IsReadOnly; gp.SpatialContextAssociation = source.SpatialContextAssociation; return gp; } case PropertyDefinitionType.Raster: { var source = (RasterPropertyDefinition)prop; var rp = new RasterPropertyDefinition(prop.Name, prop.Description); rp.DefaultImageXSize = source.DefaultImageXSize; rp.DefaultImageYSize = source.DefaultImageYSize; rp.IsNullable = source.IsNullable; rp.IsReadOnly = source.IsReadOnly; rp.SpatialContextAssociation = source.SpatialContextAssociation; return rp; } } throw new ArgumentException(); }
private static GeometricPropertyDefinition ConvertGeometricProperty(MgGeometricPropertyDefinition mgGeom) { var gp = new GeometricPropertyDefinition(mgGeom.Name, mgGeom.Description); gp.GeometricTypes = (FeatureGeometricType)mgGeom.GeometryTypes; gp.HasElevation = mgGeom.HasElevation; gp.HasMeasure = mgGeom.HasMeasure; gp.IsReadOnly = mgGeom.ReadOnly; gp.SpatialContextAssociation = mgGeom.SpatialContextAssociation; return gp; }
private void chkGeometry_CheckedChanged(object sender, EventArgs e) { if (!chkGeometry.Checked) { if (_item != null) { //Remove existing geometry property if defined if (!string.IsNullOrEmpty(_item.Class.DefaultGeometryPropertyName)) { var prop = _item.Class.FindProperty(_item.Class.DefaultGeometryPropertyName); if (prop != null) { _item.Class.RemoveProperty(prop); } _item.Class.DefaultGeometryPropertyName = null; } } txtSpatialContext.Text = txtX.Text = txtY.Text = txtZ.Text = string.Empty; } else { if (_item != null) { //Set logical geometry property var prop = new GeometricPropertyDefinition("Geometry", ""); //NOXLATE prop.GeometricTypes = FeatureGeometricType.Point; prop.HasElevation = true; prop.HasMeasure = true; _item.Class.AddProperty(prop); _item.Class.DefaultGeometryPropertyName = prop.Name; if (_scNames.Length > 0) txtSpatialContext.Text = _scNames[0]; } } }