void mi_Move_Click(object sender, EventArgs e) { m_IsMoveMode = true; m_LastMovedTargetLayerGuid = m_TargetLayerGuid; m_MiMove.Visible = false; m_MiApplyMovement.Visible = true; m_MiCancelMovement.Visible = true; m_BufZoneUserLayer = UserDbLayersManager.GetUserLayer(m_TargetLayerGuid); m_BufZoneLayer = (EidssUserBufZoneLayer)m_BufZoneUserLayer; m_BufZoneBeforeEdit = m_BufZoneLayer.FeatureRowToStruct(m_SelectedFeature); var wkb = m_SelectedFeature.Geometry.AsBinary();//.AsText(); m_GeomBeforeEdit = Geometry.GeomFromWKB(wkb); SubscribeApplyEvents(); MapImage.RefreshFromCache(); }
/// <summary> /// Deserialize VectorLayer /// </summary> /// <param name="vectorLayerElement">Root element to deserialize</param> /// <returns>VectorLayer</returns> public static EidssUserDbLayer Deserialize(XmlElement vectorLayerElement) { EidssUserDbLayer resultVectorLayer = null; XmlNode tempNode; LayerSerializer.LayerInfo lyrInfo; bool tempBool; int tempInt; #region <<Deserialize LayerFields >> try { lyrInfo = LayerSerializer.DeserializeLayerFields(vectorLayerElement); } catch (Exception ex) { throw new VectorLayerDeserializationException("VectorLayer can't be deserialized: " + ex.Message, ex); } //LayerDbGuid tempNode = vectorLayerElement.SelectSingleNode("LayerDbGuid"); if (tempNode == null) { throw new VectorLayerDeserializationException("VectorLayer can't be deserialized: 'LayerElement' don't have element 'LayerDbGuid'!"); } var layerDbGuid = new Guid(tempNode.InnerText); //LabelLayer Guid tempNode = vectorLayerElement.SelectSingleNode("LabelLayerGuid"); if (tempNode == null) { throw new VectorLayerDeserializationException("VectorLayer can't be deserialized: 'LayerElement' don't have element 'LabelLayerGuid'!"); } var labelLayerGuid = new Guid(tempNode.InnerText); //create layer switch (vectorLayerElement.Attributes["Type"].Value) { case "eidss.gis.Layers.EidssUserDbLayer": resultVectorLayer = new EidssUserDbLayer(layerDbGuid, lyrInfo.LayerName, lyrInfo.Guid, labelLayerGuid); break; case "eidss.gis.Layers.EidssUserBufZoneLayer": resultVectorLayer = new EidssUserBufZoneLayer(layerDbGuid, lyrInfo.LayerName, lyrInfo.Guid, labelLayerGuid); break; } resultVectorLayer.ControledByUser = lyrInfo.ControledByUser; resultVectorLayer.Enabled = lyrInfo.Enabled; resultVectorLayer.MaxVisible = lyrInfo.MaxVisible; resultVectorLayer.MinVisible = lyrInfo.MinVisible; //resultVectorLayer.SRID = lyrInfo.SRID; - тут бля косяк в провайдере! нет проверки! resultVectorLayer.VisibleInTOC = lyrInfo.VisibleInTOC; resultVectorLayer.Transparency = lyrInfo.Transparency; #endregion #region << Deserialize >> //ClippingEnabled tempNode = vectorLayerElement.SelectSingleNode("ClippingEnabled"); if (tempNode == null) { throw new VectorLayerDeserializationException("'VectorLayerElement' don't have element 'ClippingEnabled'!"); } if (!bool.TryParse(tempNode.InnerText, out tempBool)) { throw new VectorLayerDeserializationException("Can't parse node 'ClippingEnabled'!"); } resultVectorLayer.ClippingEnabled = tempBool; //SmoothingMode tempNode = vectorLayerElement.SelectSingleNode("SmoothingMode"); if (tempNode == null) { throw new VectorLayerDeserializationException("'VectorLayerElement' don't have element 'SmoothingMode'!"); } if (!Int32.TryParse(tempNode.InnerText, out tempInt) || !Enum.IsDefined(typeof(SmoothingMode), tempInt)) { throw new VectorLayerDeserializationException("Can't parse node 'SmoothingMode'!"); } resultVectorLayer.SmoothingMode = (SmoothingMode)tempInt; //SRID tempNode = vectorLayerElement.SelectSingleNode("SRID"); if (tempNode == null) { throw new VectorLayerDeserializationException("'VectorLayerElement' don't have element 'SRID'!"); } if (!Int32.TryParse(tempNode.InnerText, out tempInt)) { throw new VectorLayerDeserializationException("Can't parse node 'SRID'!"); } resultVectorLayer.SRID = tempInt; //Style try { resultVectorLayer.Style = (VectorStyle)StyleSerializer.DeserializeFromNode(vectorLayerElement); } catch (Exception ex) { throw new VectorLayerSerializationException("Style can't be deserialized: " + ex.Message, ex); } //Theme try { resultVectorLayer.Theme = ThemeSerializer.DeserializeFromNode(vectorLayerElement); } catch (Exception ex) { throw new VectorLayerSerializationException("Theme can't be deserialized: " + ex.Message, ex); } //Marker size tempNode = vectorLayerElement.SelectSingleNode("MarkerSize"); if (tempNode == null) { throw new VectorLayerDeserializationException("'VectorLayerElement' don't have element 'MarkerSize'!"); } if (!Int32.TryParse(tempNode.InnerText, out tempInt)) { throw new VectorLayerDeserializationException("Can't parse node 'MarkerSize'!"); } resultVectorLayer.MarkerSize = tempInt; //Marker color try { resultVectorLayer.MarkerColor = ColorSerializer.DeserializeFromNode(vectorLayerElement, "MarkerColor"); } catch (Exception ex) { throw new VectorLayerSerializationException("MarkerColor can't be deserialized: " + ex.Message, ex); } //Polygon Fill Style tempNode = vectorLayerElement.SelectSingleNode("PolygonFillStyle"); if (tempNode == null) { throw new VectorLayerDeserializationException("'VectorLayerElement' don't have element 'PolygonFillStyle'!"); } resultVectorLayer.PolygonFillStyle = tempNode.InnerText; //Polygon Fill Color try { resultVectorLayer.PolygonFillColor = ColorSerializer.DeserializeFromNode(vectorLayerElement, "PolygonFillColor"); } catch (Exception ex) { throw new VectorLayerSerializationException("PolygonFillColor can't be deserialized: " + ex.Message, ex); } #endregion return(resultVectorLayer); }