public void Apply(IMap map) { try { _map = map; // ucLayersControl1.RootLayerItem.Clear(); propertyGrid1.SelectedObject = null; // if (_map == null || _map.LayerContainer == null || _map.LayerContainer.Layers == null || _map.LayerContainer.Layers.Length == 0) { return; } else { LayerItem maproot = new LayerItem(_map.Name); maproot.Tag = _map; ucLayersControl1.RootLayerItem.Add(maproot); foreach (ILayer layer in _map.LayerContainer.Layers) { LayerItem lyrItem = new LayerItem(layer.Name); lyrItem.Enabled = (layer as ILayerDrawable).Visible; lyrItem.Tag = layer; maproot.Add(lyrItem); } } } finally { Invalidate(); } }
protected internal override void DoUndo() { var oldItems = new List <LayerItem>(); foreach (var item in data) { //var updateRectangle = RectangleI.Cleared; var oldValues = new Dictionary <Vector2I, float>(item.values.Count); foreach (var pair in item.values) { float value = item.layer.GetMaskValue(pair.Key); oldValues.Add(pair.Key, value); item.layer.SetMaskValue(pair.Key, pair.Value); //updateRectangle.Add( pair.Key ); } var oldItem = new LayerItem(); oldItem.layer = item.layer; oldItem.values = oldValues; oldItems.Add(oldItem); } data = oldItems; //terrain.UpdateRenderingData( updateRectangle ); //terrain.UpdateCollisionData( updateRectangle ); }
public ILayerItem AddLayer(string fname) { ILayerItem newLayer = new LayerItem(fname, fname); this.Items.Add(newLayer); return(newLayer); }
private string ConvertLayerToWMS(LayerItem layer) { //TODO: Add layer abstracts from wms as <Description> in xml //TODO: Add legends as screenoverlays where applicable string skeleton; string FILE_NAME = this.wms_skeleton_path; string mapfilepath; skeleton = ReadSkeleton(FILE_NAME); skeleton = skeleton.Replace(@"$NAME", ConvertToXMLEntities(layer.Title)); skeleton = skeleton.Replace(@"$NBB", layer.LLBoundingBox.MaxY.ToString(CultureInfo.InvariantCulture)); skeleton = skeleton.Replace(@"$SBB", layer.LLBoundingBox.MinY.ToString(CultureInfo.InvariantCulture)); skeleton = skeleton.Replace(@"$EBB", layer.LLBoundingBox.MaxX.ToString(CultureInfo.InvariantCulture)); skeleton = skeleton.Replace(@"$WBB", layer.LLBoundingBox.MinX.ToString(CultureInfo.InvariantCulture)); //replace request getcapabilities with getmap //string wmsGetMap = wmsGetCapstextbox.Text.ToLowerInvariant().Replace("request=getcapabilities", "request=getmap"); string wmsGetMap = Regex.Replace(wmsGetCapstextbox.Text.ToLowerInvariant(), "\\?.*$", ""); //check for wms that requires path to .map file in url if (wmsGetCapstextbox.Text.ToLowerInvariant().Contains("map=")) { mapfilepath = Regex.Match(wmsGetCapstextbox.Text, "map=.*\\.map").Value; skeleton = skeleton.Replace(@"$LAYERNAME", layer.Name + @"&TRANSPARENT=TRUE&BGCOLOR=0xFF00FF&" + mapfilepath); } else { skeleton = skeleton.Replace(@"$LAYERNAME", layer.Name + @"&TRANSPARENT=TRUE&BGCOLOR=0xFF00FF"); } skeleton = skeleton.Replace(@"$SERVER", ConvertToXMLEntities(wmsGetMap)); return(skeleton); }
protected internal void SetMouseEvent(Layer layer, LayerItem item, IEnumerable <Layer> selectedLayers, MouseEventType eventType, MouseEventArgs eventArgs) { this.SetMouseEvent(eventType, (MouseButtonsDg)eventArgs.Button, eventArgs.Clicks, eventArgs.Delta, eventArgs.Location, (KeysDg)Control.ModifierKeys); this.Item = item; this.Layer = layer; this.SelectedLayers = selectedLayers; }
public static void Assign(Graph g) { Selected = null; Instance.LayerStack.Children.Clear(); Current = g; Instance.Populate(); }
protected void Populate() { if (Current != null) { foreach (Layer layer in Current.Layers) { //create layer stuff LayerItem item = new LayerItem(layer); item.Height = 32; LayerStack.Children.Add(item); item.OnSelect += Item_OnSelect; item.OnView += Item_OnView; } AddLayerButton.IsEnabled = true; } else { AddLayerButton.IsEnabled = false; } DeleteLayerButton.IsEnabled = false; BlendModeDropDown.IsEnabled = false; OpacitySlider.IsEnabled = false; }
private void RemoveLayer(LayerItem layer) { if (Current.Layers.Remove(layer.Item)) { Current.LayerLookup.Remove(layer.Item.Id); Current.Layers.Remove(layer.Item); LayerStack.Children.Remove(layer); if (layer.State == LayerItemState.SelectedViewing || layer.State == LayerItemState.Viewing) { OnRestoreRootView?.Invoke(Current); } Current.Modified = true; Current?.CombineLayers(); OnRemoveLayer?.Invoke(layer.Item); layer.Item?.Dispose(); layer.OnSelect -= Item_OnSelect; layer.OnView -= Item_OnView; if (Selected == layer) { DeleteLayerButton.IsEnabled = false; BlendModeDropDown.IsEnabled = false; OpacitySlider.IsEnabled = false; Selected = null; } } }
private void AddToTree(TreeNodeCollection nodes, LayerItem layer, Figure first) { foreach (var fig in _layer.Figures.ToList().AsEnumerable().Reverse()) { if (layer == null && !_layer.AssignedToLayer(fig) || layer != null && layer.Figures.Contains(fig)) { var state = !_layer.IsVisible(fig) ? " (hidden)" : _layer.IsLocked(fig) ? " (locked)" : ""; var fignode = new FigureTreeNode( string.Format("{0}{1}", fig.Geometry, state)) { Figure = fig }; nodes.Add(fignode); AddDecorators(fig, fignode); if (fig == first) { tvFigures.SelectedNode = fignode; fignode.ExpandAll(); } } } }
public LayerItemViewModel(LayerItem data) { //if (string.IsNullOrEmpty(data.Name)) // data.Name = "Default"; Data = data; }
private void DuplicateLayer(Layer l) { Layer copy = new Layer(l); LayerItem layerItem = new LayerItem(copy); layerItem.Height = 32; layerItem.OnSelect += Item_OnSelect; layerItem.OnView += Item_OnView; if (Current.Layers.Count > 0) { Current.Layers.Insert(0, copy); } else { Current.Layers.Add(copy); } Current.LayerLookup[copy.Id] = copy; if (LayerStack.Children.Count > 0) { LayerStack.Children.Insert(0, layerItem); } else { LayerStack.Children.Add(layerItem); } Current.Modified = true; copy.TryAndProcess(); }
private string ParseNodeChildren(TreeNode node, string Username, string Password) { string returned = null; if (node.Nodes.Count != 0) { LayerItem li = node.Tag as LayerItem; if (node.Level != 0) { returned += "<ChildLayerSet Name=\"" + li.Title + "\" ShowOnlyOneLayer=\"false\" ShowAtStartup=\"true\">\n"; } foreach (TreeNode subNode in node.Nodes) { returned += ParseNodeChildren(subNode, Username, Password); } if (node.Level != 0) { returned += "</ChildLayerSet>\n"; } return(returned); } else { LayerItem li = node.Tag as LayerItem; returned += ConvertLayerToWMS(li, Username, Password); return(returned); } }
public LayerItemViewModel(LayerItem layerItem) { _layerItem = layerItem; var options = FileManipulationService.LoadOptions(); _assetsFolder = options.AssetsFolder; }
private void treeOgcCaps_AfterSelect(object sender, TreeViewEventArgs e) { // Check if selected node exists if (treeOgcCaps.SelectedNode == null) { return; } // Get selected layer data LayerItem layer = treeOgcCaps.SelectedNode.Tag as LayerItem; if (layer == null) { return; } // Set map view paramerters //pictureBoxOGC1.URL = treeOgcCaps.URL; //pictureBoxOGC1.ServiceType = OGCServiceTypes.WMS; //pictureBoxOGC1.LayerName = layer.Name; // Set layer name //pictureBoxProgressBar.Value = 0; // Update image //pictureBoxOGC1.GetImage(); //System.Windows.Forms.Timer pictureBoxTimer = new System.Windows.Forms.Timer(); //pictureBoxTimer.Enabled = true; //pictureBoxTimer.Interval = 50; //pictureBoxTimer.Tick += new EventHandler(pictureBoxTimer_Tick); }
private void InitLayers() { _items.Clear(); IMap pMap = _context.MapControl.Map; for (int i = 0; i < pMap.LayerCount; i++) { ILayer layer = pMap.Layer[i]; if (layer is IGroupLayer) { this.FillCompLayer(layer as ICompositeLayer); } else if (layer is IFeatureLayer) { IFeatureLayer featureLayer = layer as IFeatureLayer; LayerItem item = new LayerItem(featureLayer.Name, featureLayer); _items.Add(item); } } if (_linkCombo != null) { ((RepositoryItemComboBox)_linkCombo.Edit).Items.Clear(); ((RepositoryItemComboBox)_linkCombo.Edit).Items.AddRange(_items.ToArray()); } }
protected internal void SetMouseEvent(Layer layer, LayerItem item, IEnumerable <Layer> selectedLayers, MouseEventType eventType, MouseEventArgsDg eventArgs) { this.SetMouseEvent(eventType, eventArgs.Buttons, eventArgs.Clicks, eventArgs.WheelDelta, eventArgs.Position, eventArgs.Modifiers); this.Item = item; this.Layer = layer; this.SelectedLayers = selectedLayers; }
/// <ToBeCompleted></ToBeCompleted> public LayerMouseEventArgs(Layer layer, LayerItem item, MouseEventType eventType, MouseButtonsDg buttons, int clickCount, int wheelDelta, Point position, KeysDg modifiers) : base(eventType, buttons, clickCount, wheelDelta, position, modifiers) { this.layer = layer; this.item = item; }
/// <ToBeCompleted></ToBeCompleted> public LayerMouseEventArgs(Layer layer, LayerItem item, IEnumerable <Layer> selectedlayers, MouseEventType eventType, MouseButtonsDg buttons, int clickCount, int wheelDelta, Point position, KeysDg modifiers) : base(eventType, buttons, clickCount, wheelDelta, position, modifiers) { this._layer = layer; this._item = item; this._selectedLayers = new List <Layer>(selectedlayers); }
private void LayerRemoved(Layer layer) { LayerItem item = layers[layer]; layers.Remove(layer); item.gameObject.SetActive(false); Destroy(item.gameObject); }
private void AddLayerItem( LayerItem item ) { _listLayers.Items.Insert( 0, item ); _listLayers.SelectedItem = item; item.Layer.NameChanged += new EventHandler( Layer_NameChanged ); _btnLayerDelete.Enabled = ( _listLayers.Items.Count > 1 ); }
/// <summary> /// レイヤーアイテム内にキャラスクリプト用定義が存在するか否かを取得する。 /// </summary> /// <param name="layerItem">レイヤーアイテム。</param> /// <returns> /// キャラスクリプト用定義が存在するならば true 。そうでなければ false 。 /// </returns> private static bool ContainsCharaScript(LayerItem layerItem) => layerItem .GetComponents <UnknownComponent>() .Any( c => c.ComponentName == @"アニメーション効果" && c.Items.Any( i => i.Name == @"name" && i.Value.EndsWith(@"@キャラ素材")));
private void AddSubItems(LayerItem item, ListViewItem lvi) { lvi.SubItems.Add(string.Format("{0}", item.Figures.Count)).Tag = 1; for (var i = 2; i < _allowed.Length; i++) { var si = lvi.SubItems.Add(string.Format("{0}", item.AllowedOperations.HasFlag(_allowed[i]))); si.Tag = i; } }
public void btnCoinClick() { LayerCoin.SetActive(true); LayerItem.SetActive(false); btnItem.GetComponent <Image>().sprite = itemLayerOff; btnCoin.GetComponent <Image>().sprite = coinLayerOn; iTween.ScaleTo(btnItem.gameObject, scaleCurrent, 0.5f); iTween.ScaleTo(btnCoin.gameObject, scaleClick, 0.5f); }
void ucLayersControl1_OnLayerItemEnabledChanged(LayerItem layerItem) { IFeatureLayer lyr = layerItem.Tag as IFeatureLayer; if (lyr != null) { (lyr as ILayerDrawable).Visible = !(lyr as ILayerDrawable).Visible; } }
private void ScrollViewer_Drop(object sender, DragEventArgs e) { string data = (string)e.Data.GetData(DataFormats.Text); if (data.Contains("Materia::Layer::")) { Point p = e.GetPosition(ScrollView); double offset = ScrollView.VerticalOffset; double realY = offset + p.Y; LayerItem orig = LayerStack.Children.OfType <LayerItem>().FirstOrDefault(m => data.Contains(m.Item.Id)); if (orig == null) { return; } LayerStack.Children.Remove(orig); bool added = false; for (int i = 0; i < LayerStack.Children.Count; ++i) { LayerItem item = LayerStack.Children[i] as LayerItem; if (item == null) { continue; } if (item == orig) { continue; } Point relative = item.TransformToAncestor(LayerStack).Transform(new Point(0, 0)); if (realY >= relative.Y && realY <= relative.Y + item.ActualHeight) { LayerStack.Children.Insert(i, orig); //update graph layer data as well Current.Layers.Remove(orig.Item); Current.Layers.Insert(i, orig.Item); added = true; break; } } if (!added) { LayerStack.Children.Add(orig); Current.Layers.Remove(orig.Item); Current.Layers.Add(orig.Item); } Current?.CombineLayers(); } }
/// <ToBeCompleted></ToBeCompleted> public LayerMouseEventArgs(Layer layer, LayerItem item, MouseEventArgsDg mouseEventArgs) : this(layer, item, mouseEventArgs.EventType, mouseEventArgs.Buttons, mouseEventArgs.Clicks, mouseEventArgs.WheelDelta, mouseEventArgs.Position, mouseEventArgs.Modifiers) { if (layer == null) { throw new ArgumentNullException("layer"); } this.layer = layer; this.item = item; }
private void treeOgcCaps_OperationDone(object sender, EventArgs e) { TreeNode tn = treeOgcCaps.Nodes[0]; LayerItem li = tn.Tag as LayerItem; textBox3.Text = li.Title; xmlsaveGroupBox.Enabled = true; treeViewProgressBar.Visible = false; }
private void AddItem(LayerItem item) { var lvi = new ListViewItem(item.Name) { Name = item.Name, Tag = item }; AddSubItems(item, lvi); lvLayers.Items.Add(lvi); }
/// <summary> /// Get the visiblity of a layer by its Id. /// </summary> /// <param name="id">Id of layer.</param> /// <returns>Visibility.</returns> public static bool GetIsCheckedById(int id) { LayerItem layer = GetLayerById(id); if (layer != null) { return(layer.IsChecked); } return(false); }
private void UpdateObject() { if (_updating > 0) { return; // we are in updating mode } // fire event StartChanging(this, new ChangingEventArgs("Layer Property")); // send values back from GUI to object // поиск удаляемых var found = new List <LayerItem>(_layer.Layers); foreach (var item in _layer.Layers) { foreach (var lvi in lvLayers.Items.Cast <ListViewItem>()) { if (item == lvi.Tag) { found.Remove(item); } } } _layer.Layers.RemoveAll(item => found.Contains(item)); // удаление слоёв с пустыми списками фигур, если указано if (cboxRemoveUnusedLayers.Checked) { _layer.Layers.RemoveAll(item => item.Figures.Count == 0); } // поиск новых и изменённых foreach (var lvi in lvLayers.Items.Cast <ListViewItem>()) { var item = lvi.Tag as LayerItem; if (item.Name == null) { item = new LayerItem() { Name = lvi.Text }; _layer.Layers.Add(item); } else if (item.Name != lvi.Text) { item.Name = lvi.Text; } UpdateOperations(item, lvi); } // fire event Changed(this, EventArgs.Empty); UpdateListView(); btnApply.Enabled = false; }
public static string GetMBTileFileName(int rasterId) { LayerItem layer = GetLayerById(rasterId); if (layer != null) { return(layer.FileName); } return(null); }
/// <ToBeCompleted></ToBeCompleted> public LayerMouseEventArgs(Layer layer, LayerItem item, MouseEventArgsDg mouseEventArgs) : this(layer, item, mouseEventArgs.EventType, mouseEventArgs.Buttons, mouseEventArgs.Clicks, mouseEventArgs.WheelDelta, mouseEventArgs.Position, mouseEventArgs.Modifiers) { if (layer == null) throw new ArgumentNullException("layer"); this.layer = layer; this.item = item; }
/// <summary> /// レイヤーアイテムからセクション群を作成して追加する。 /// </summary> /// <param name="layerItem">レイヤーアイテム。</param> /// <param name="index">レイヤーアイテムインデックス。</param> /// <param name="target">追加先のセクションコレクション。</param> private static void FromLayerItemToSections( LayerItem layerItem, int index, IniFileSectionCollection target) { Debug.Assert(layerItem != null); Debug.Assert(index >= 0); Debug.Assert(target != null); // ベースセクションアイテム群取得 var items = ExoFileItemsConverter.ToItems(layerItem); // ベースセクションアイテム群を整理 if (layerItem.GroupId <= 0) { items.Remove(LayerItem.ExoFileItemNameOfGroupId); } if (layerItem.IsAudio) { items.Remove(LayerItem.ExoFileItemNameOfIsClipping); items.Remove(LayerItem.ExoFileItemNameOfIsCameraTarget); } else { items.Remove(LayerItem.ExoFileItemNameOfIsAudio); if (!layerItem.IsClipping) { items.Remove(LayerItem.ExoFileItemNameOfIsClipping); } } if (layerItem.ChainIndex < 0) { items.Remove(LayerItem.ExoFileItemNameOfChainIndex); } // ベースセクション追加 var baseName = index.ToString(); target.Add(baseName, items); // コンポーネントセクション群追加 baseName += '.'; foreach (var v in layerItem.Components.Select((c, i) => new { c, i })) { target.Add(baseName + v.i, v.c.ToExoFileItems()); } }
/// <summary> /// セクションコレクションからレイヤーアイテムを作成する。 /// </summary> /// <param name="sections">セクションコレクション。</param> /// <param name="baseSection">ベースセクション。</param> /// <returns>レイヤーアイテム。</returns> private static LayerItem FromSectionsToLayerItem( IniFileSectionCollection sections, IniFileSection baseSection) { Debug.Assert(sections != null); Debug.Assert(baseSection != null); var result = new LayerItem(); // ベースセクションのプロパティ値設定 ExoFileItemsConverter.ToProperties(baseSection.Items, ref result); // コンポーネント群追加 var componentSections = Enumerable .Range(0, int.MaxValue) .Select( i => sections.FirstOrDefault( s => s.Name == baseSection.Name + @"." + i)) .TakeWhile(s => s != null); foreach (var cs in componentSections) { result.Components.Add(ComponentMaker.FromExoFileItems(cs.Items)); } return result; }
/// <ToBeCompleted></ToBeCompleted> protected internal LayerMouseEventArgs() : base() { layer = null; item = LayerItem.None; }
public LayerListViewMouseEventArgs(Layer layer, LayerItem item, MouseEventType eventType, MouseButtonsDg buttons, int clickCount, int wheelDelta, Point position, KeysDg modifiers) : base(layer, item, eventType, buttons, clickCount, wheelDelta, position, modifiers) { }
protected internal void SetMouseEvent(Layer layer, LayerItem item, MouseEventType eventType, MouseEventArgsDg eventArgs) { this.SetMouseEvent(eventType, eventArgs.Buttons, eventArgs.Clicks, eventArgs.WheelDelta, eventArgs.Position, eventArgs.Modifiers); this.Item = item; this.Layer = layer; }
protected internal void SetMouseEvent(Layer layer, LayerItem item, MouseEventType eventType, MouseEventArgs eventArgs) { this.SetMouseEvent(eventType, (MouseButtonsDg)eventArgs.Button, eventArgs.Clicks, eventArgs.Delta, eventArgs.Location, (KeysDg)Control.ModifierKeys); this.Layer = layer; this.Item = item; }
private string ConvertLayerToWMS(LayerItem layer) { //TODO: Add layer abstracts from wms as <Description> in xml //TODO: Add legends as screenoverlays where applicable string skeleton; string FILE_NAME = this.wms_skeleton_path; string mapfilepath; skeleton = ReadSkeleton(FILE_NAME); skeleton = skeleton.Replace(@"$NAME", ConvertToXMLEntities(layer.Title)); skeleton = skeleton.Replace(@"$NBB", layer.LLBoundingBox.MaxY.ToString(CultureInfo.InvariantCulture)); skeleton = skeleton.Replace(@"$SBB", layer.LLBoundingBox.MinY.ToString(CultureInfo.InvariantCulture)); skeleton = skeleton.Replace(@"$EBB", layer.LLBoundingBox.MaxX.ToString(CultureInfo.InvariantCulture)); skeleton = skeleton.Replace(@"$WBB", layer.LLBoundingBox.MinX.ToString(CultureInfo.InvariantCulture)); //replace request getcapabilities with getmap //string wmsGetMap = wmsGetCapstextbox.Text.ToLowerInvariant().Replace("request=getcapabilities", "request=getmap"); string wmsGetMap = Regex.Replace(wmsGetCapstextbox.Text.ToLowerInvariant(), "\\?.*$", ""); //check for wms that requires path to .map file in url if (wmsGetCapstextbox.Text.ToLowerInvariant().Contains("map=")) { mapfilepath = Regex.Match(wmsGetCapstextbox.Text, "map=.*\\.map").Value; skeleton = skeleton.Replace(@"$LAYERNAME", layer.Name + @"&TRANSPARENT=TRUE&BGCOLOR=0xFF00FF&" + mapfilepath); } else { skeleton = skeleton.Replace(@"$LAYERNAME", layer.Name + @"&TRANSPARENT=TRUE&BGCOLOR=0xFF00FF"); } skeleton = skeleton.Replace(@"$SERVER", ConvertToXMLEntities(wmsGetMap)); return skeleton; }
private void RemoveLayerItem( LayerItem item ) { Global.SelectedLevel2.DeleteLayer( item.Layer ); _listLayers.Items.Remove( item ); _btnLayerDelete.Enabled = ( _listLayers.Items.Count > 1 ); }