public static LayerProperties[] EnumerateInstanceLayerProperties() { unsafe { uint pPropertyCount; var result = Interop.NativeMethods.vkEnumerateInstanceLayerProperties(&pPropertyCount, null); if (result != Result.Success) { throw new ResultException(result); } if (pPropertyCount <= 0) { return(null); } var size = Marshal.SizeOf(typeof(Interop.LayerProperties)); var ptrpProperties = Marshal.AllocHGlobal((int)(size * pPropertyCount)); result = Interop.NativeMethods.vkEnumerateInstanceLayerProperties(&pPropertyCount, (Interop.LayerProperties *)ptrpProperties); if (result != Result.Success) { throw new ResultException(result); } if (pPropertyCount <= 0) { return(null); } var arr = new LayerProperties [pPropertyCount]; for (var i = 0; i < pPropertyCount; i++) { arr [i] = new LayerProperties(&((Interop.LayerProperties *)ptrpProperties) [i]); } return(arr); } }
private unsafe bool CheckValidationLayerSupport() { uint layerCount = 0; _vk.EnumerateInstanceLayerProperties(&layerCount, (LayerProperties *)null); var availableLayers = new LayerProperties[layerCount]; fixed(LayerProperties *availableLayersPtr = availableLayers) { _vk.EnumerateInstanceLayerProperties(&layerCount, availableLayersPtr); } foreach (string layerName in _validationLayers) { var layerFound = false; foreach (LayerProperties layerProperties in availableLayers) { if (layerName == Marshal.PtrToStringAnsi((IntPtr)layerProperties.LayerName)) { layerFound = true; break; } } if (!layerFound) { return(false); } } return(true); }
public LayerPropertiesDialog() { this.Build(); this.Icon = PintaCore.Resources.GetIcon("Menu.Layers.LayerProperties.png"); name = PintaCore.Layers.CurrentLayer.Name; hidden = PintaCore.Layers.CurrentLayer.Hidden; opacity = PintaCore.Layers.CurrentLayer.Opacity; initial_properties = new LayerProperties( name, hidden, opacity); layerNameEntry.Text = initial_properties.Name; visibilityCheckbox.Active = !initial_properties.Hidden; opacitySpinner.Value = (int)(initial_properties.Opacity * 100); opacitySlider.Value = (int)(initial_properties.Opacity * 100); layerNameEntry.Changed += OnLayerNameChanged; visibilityCheckbox.Toggled += OnVisibilityToggled; opacitySpinner.ValueChanged += new EventHandler(OnOpacitySpinnerChanged); opacitySlider.ValueChanged += new EventHandler(OnOpacitySliderChanged); AlternativeButtonOrder = new int[] { (int)Gtk.ResponseType.Ok, (int)Gtk.ResponseType.Cancel }; DefaultResponse = Gtk.ResponseType.Ok; layerNameEntry.ActivatesDefault = true; opacitySpinner.ActivatesDefault = true; }
// Initializes the popup title on a graphics layer, given the title field name private void setPopupTitle(string titleField, GraphicsLayer layer) { Dictionary <int, string> expression = new Dictionary <int, string>(); expression.Add(-1, string.Format("{{{0}}}", titleField)); LayerProperties.SetPopupTitleExpressions(Target, expression); }
private static unsafe bool IsLayerAvailable(Vk api, string layerName) { uint layerPropertiesCount; api.EnumerateInstanceLayerProperties(&layerPropertiesCount, null).ThrowOnError(); var layerProperties = new LayerProperties[layerPropertiesCount]; fixed(LayerProperties *pLayerProperties = layerProperties) { api.EnumerateInstanceLayerProperties(&layerPropertiesCount, layerProperties).ThrowOnError(); for (var i = 0; i < layerPropertiesCount; i++) { var currentLayerName = Marshal.PtrToStringAnsi((IntPtr)pLayerProperties[i].LayerName); if (currentLayerName == layerName) { return(true); } } } return(false); }
private string GetLayerPropertyUpdateMessage(LayerProperties initial, LayerProperties updated) { string?ret = null; int count = 0; if (updated.Opacity != initial.Opacity) { ret = Translations.GetString("Layer Opacity"); count++; } if (updated.Name != initial.Name) { ret = Translations.GetString("Rename Layer"); count++; } if (updated.Hidden != initial.Hidden) { ret = (updated.Hidden) ? Translations.GetString("Hide Layer") : Translations.GetString("Show Layer"); count++; } if (ret == null || count > 1) { ret = Translations.GetString("Layer Properties"); } return(ret); }
public override bool CanExecute(object parameter) { var popupInfo = parameter as OnClickPopupInfo; if (popupInfo == null || popupInfo.PopupItem == null || !(popupInfo.PopupItem.Layer is FeatureLayer) || popupInfo.PopupItem.Graphic == null || !((FeatureLayer)popupInfo.PopupItem.Layer).IsAddAttachmentAllowed(popupInfo.PopupItem.Graphic)) { return(false); } if (popupInfo == null || popupInfo.PopupItem == null || popupInfo.PopupItem.Layer == null) { return(false); } bool isEditable = LayerProperties.GetIsEditable(popupInfo.PopupItem.Layer); if (!isEditable) { return(false); } FeatureLayer fl = popupInfo.PopupItem.Layer as FeatureLayer; if (fl == null) { return(false); } return(fl.LayerInfo.HasAttachments); }
private string[] GetLayerIds(string[] exludedList, bool hideBasemaps) { if (Map != null && Map.Layers != null) { List <string> layerIds = new List <string>(); foreach (Layer lay in Map.Layers) { //always filter out layers without ID if (!string.IsNullOrWhiteSpace(lay.ID) && LayerProperties.GetIsVisibleInMapContents(lay)) { //only filter out basemaps for configurable MapContents controls if ((bool)this.GetValue(ElementExtensions.IsConfigurableProperty) && hideBasemaps && (bool)lay.GetValue(ESRI.ArcGIS.Client.WebMap.Document.IsBaseMapProperty)) { continue; } else { layerIds.Add(lay.ID); } } } //only filter using excludedList for configurable MapContents controls if ((bool)this.GetValue(ElementExtensions.IsConfigurableProperty) && exludedList != null) { return(layerIds.Except <string>(exludedList).ToArray()); } else { return(layerIds.ToArray()); } } return(null); }
public LayerProperties(LayerProperties copyMe) { this.name = copyMe.name; this.userMetaData = new NameValueCollection(copyMe.userMetaData); this.visible = copyMe.visible; this.isBackground = copyMe.isBackground; this.opacity = copyMe.opacity; }
String PropertyNamed(string propertyName) { string property = String.Empty; LayerProperties.TryGetValue(propertyName, out property); return(property); }
private void EnumerateLayerProperties() { LayerProperties[] properties = Instance.EnumerateLayerProperties(); Assert.NotEmpty(properties); LayerProperties firstProperty = properties[0]; Assert.StartsWith(firstProperty.LayerName, properties[0].ToString()); }
public static Result EnumerateInstanceLayerProperties(out UInt32 PropertyCount, out LayerProperties Properties) { unsafe { fixed(UInt32 *ptrPropertyCount = &PropertyCount) { Properties = new LayerProperties(); return(Interop.NativeMethods.vkEnumerateInstanceLayerProperties(ptrPropertyCount, (IntPtr)Properties.m)); } } }
public override void SetOptions(LayerProperties options) { _properties = (VectorLayerProperties)options; if (_layerBuilder != null) { RemoveAllLayerVisualiers(); CreatePOILayerVisualizers(); CreateLayerVisualizers(); } }
/// <summary> /// Executes edit values command if that is the mode we are in /// </summary> /// <param name="popupInfo"></param> public static void SyncPreviousDisplayMode(OnClickPopupInfo popupInfo) { if (popupInfo == null || popupInfo.PopupItem == null) { return; } InfoWindow win = popupInfo.Container as InfoWindow; if (win == null || OnClickPopupControl == null) { return; } // find the edit values command associated with the active tool EditValuesCommand editValues = OnClickPopupControl.GetEditValuesToolCommand(); bool isEditable = LayerProperties.GetIsEditable(popupInfo.PopupItem.Layer); if (isEditable) { if (editValues == null) { //if we were showing edit values panel, show that again if (_wasEditingValues && popupInfo != null && popupInfo.Container is InfoWindow) { win.Dispatcher.BeginInvoke(() => { EditValuesCommand cmd = new EditValuesCommand(); cmd.Execute(popupInfo); }); } } else { if (_wasEditingValues) { win.Dispatcher.BeginInvoke(() => { editValues.Execute(popupInfo); }); } else { editValues.BackToOriginalContent(popupInfo); } } } else if (editValues != null) { editValues.BackToOriginalContent(popupInfo); } }
private void MenuItemProperties_Click(object sender, EventArgs e) { var item = sender as DXMenuItem; var layer = Newtonsoft.Json.JsonConvert.DeserializeObject <LayerItemModel>(item.Tag.ToString()); var table = this.OpenedTables.FirstOrDefault(async => async.TableName == layer.LayerName); LayerProperties form = new LayerProperties(); form.Table = table; form.Owner = this; form.ShowDialog(); }
protected Layer (string name) { Uid = Guid.NewGuid(); _opacity = 1f; _visible = true; _rasterMode = RasterMode.Point; _name = name; _properties = new PropertyCollection(_reservedPropertyNames); _predefinedProperties = new LayerProperties(this); _properties.Modified += (s, e) => OnModified(EventArgs.Empty); }
public void DumpInfo(StreamWriter output) { uint apiVersion = Vulkan.Version.Make(1, 0, 0); DumpHeader(apiVersion, output); AppInstance instance = AppCreateInstance(apiVersion); output.WriteLine("Instance Extensions and layers:"); output.WriteLine("==============================="); AppDumpExtensions("", "Instance", instance.Extensions, output); output.WriteLine("Instance Layers\tcount = {0}", instance.Layers.Length); foreach (LayerExtensionList layer in instance.Layers) { LayerProperties layerProp = layer.LayerProperties; uint major, minor, patch; ExtractVersion(layerProp.SpecVersion, out major, out minor, out patch); string specVersion = string.Format("{0}.{1}.{2}", major, minor, patch); string layerVersion = string.Format("{0}", layerProp.ImplementationVersion); output.WriteLine("\t{0} ({1}) Vulkan version {2}, layer version {3}", layerProp.LayerName, layerProp.Description, specVersion, layerVersion); AppDumpExtensions("\t", layerProp.LayerName, layer.ExtensionProperties, output); } PhysicalDevice[] objs = instance.Instance.EnumeratePhysicalDevices(); AppGpu[] gpus = new AppGpu[objs.Length]; for (uint i = 0; i < objs.Length; i++) { gpus[i] = AppGpuInit(i, objs[i]); AppGpuDump(gpus[i], output); output.WriteLine(); output.WriteLine(); } for (uint i = 0; i < gpus.Length; i++) { AppGpuDestroy(gpus[i]); } AppDestroyInstance(instance); output.Flush(); }
public Layer(INeuronFactory factory) : base(typeof(NeuronBase)) { _neuronFactory = factory; _compactInputsView = true; _compactOutputsView = true; _neuronsCount = 1; // each layer has one neuron by defeault if (_neuronFactory.PropertyProviders.TryGetValue(this.GetType(), out IPropertiesProvider provider) && provider is LayerProperties layerProperties) { _propertiesProvider = layerProperties; } this.Properties = this; }
public void SetSoilLayerBaseProperties_SoilLayerNull_ThrowsArgumentNullException() { // Setup var mockRepository = new MockRepository(); var reader = mockRepository.Stub <IRowBasedDatabaseReader>(); var properties = new LayerProperties(reader, ""); // Call TestDelegate call = () => SoilLayerHelper.SetSoilLayerBaseProperties(null, properties); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("soilLayer", exception.ParamName); }
public LayerEditor(LevelEditor parentLevel, string name) { _properties = new LayerProperties { Name = name, CustomProperties = new CustomProperties( ), Visible = true, ScrollSpeed = Vector2.One }; ParentLevel = parentLevel; Items = new List <ItemEditor>(); _behaviours = new BehaviourCollection( ); }
Collection <int> getIdentifyLayerIds(Layer layer) { if (!(layer is ArcGISDynamicMapServiceLayer) && !(layer is ArcGISTiledMapServiceLayer)) { throw new ArgumentException(Strings.LayerTypeError); } // Get layer as dynamic to access GetLayerVisibility without type-casting dynamic dynLayer = layer as dynamic; IDictionary <int, string> templates = LayerProperties.GetPopupDataTemplates(layer); if (templates == null && ESRI.ArcGIS.Mapping.Core.LayerExtensions.GetUsePopupFromWebMap(layer)) { templates = ESRI.ArcGIS.Mapping.Core.LayerExtensions.GetWebMapPopupDataTemplates(layer); } Collection <int> ids = new Collection <int>(); if (templates != null) // web map pop-ups are being used. Base inclusion on whether sub-layer is visible. { foreach (var item in templates) { if (!string.IsNullOrEmpty(item.Value) && dynLayer.GetLayerVisibility(item.Key)) { ids.Add(item.Key); } } } else { // Get sub-layers for which pop-ups have been enabled Collection <int> enabledIDs = ESRI.ArcGIS.Mapping.Core.LayerExtensions.GetIdentifyLayerIds(layer); // Filter sub-layers based on visibility foreach (int id in enabledIDs) { // Check whether sub-layer and parent layers are visible if (dynLayer.GetLayerVisibility(id) && parentLayersVisible(layer, id)) { ids.Add(id); } } } return(ids); }
public override void LoadProperties(object oldState, bool suppressEvents) { if (disposed) { throw new ObjectDisposedException("BitmapLayer"); } List list = (List)oldState; // Get the base class' state, and our state LayerProperties baseState = (LayerProperties)list.Tail.Head; BitmapLayerProperties blp = (BitmapLayerProperties)(((List)oldState).Head); // Opacity is only couriered for compatibility with PDN v2.0 and v1.1 // files. It should not be present in v2.1+ files (well, it'll be // part of the base class' serialization) if (blp.opacity != -1) { baseState.opacity = (byte)blp.opacity; blp.opacity = -1; } // Have the base class load its properties base.LoadProperties(baseState, suppressEvents); // Now load our properties, and announce them to the world bool raiseBlendOp = false; if (blp.blendOp.GetType() != properties.blendOp.GetType()) { if (!suppressEvents) { raiseBlendOp = true; OnPropertyChanging(BitmapLayerProperties.BlendOpName); } } this.properties = (BitmapLayerProperties)blp.Clone(); this.compiledBlendOp = null; Invalidate(); if (raiseBlendOp) { OnPropertyChanged(BitmapLayerProperties.BlendOpName); } }
private void SetLayerVisibility(UserLayer layer, bool visibility) { var doc = PintaCore.Workspace.ActiveDocument; var initial = new LayerProperties(layer.Name, visibility, layer.Opacity, layer.BlendMode); var updated = new LayerProperties(layer.Name, !visibility, layer.Opacity, layer.BlendMode); var historyItem = new UpdateLayerPropertiesHistoryItem( Resources.Icons.LayerProperties, (visibility) ? Translations.GetString("Layer Shown") : Translations.GetString("Layer Hidden"), doc.Layers.IndexOf(layer), initial, updated); historyItem.Redo(); doc.History.PushNewItem(historyItem); }
public override bool CanExecute(object parameter) { var popupInfo = parameter as OnClickPopupInfo; PopupInfo = popupInfo; if (popupInfo == null || popupInfo.PopupItem == null || !(popupInfo.PopupItem.Layer is FeatureLayer) || popupInfo.PopupItem.Graphic == null || !((FeatureLayer)popupInfo.PopupItem.Layer).IsDeleteAllowed(popupInfo.PopupItem.Graphic)) { return(false); } bool isEditable = LayerProperties.GetIsEditable(popupInfo.PopupItem.Layer); return(isEditable); }
public override void SetOptions(LayerProperties options) { _properties = (VectorLayerProperties)options; if (_layerBuilder != null) { _layerBuilder.Clear(); CreateLayerVisualizers(); foreach (var layer in _layerBuilder) { foreach (var item in layer.Value) { (item as VectorLayerVisualizer).SetProperties(null); item.Initialize(); } } } }
protected override void Invoke(object parameter) { // Make sure the target is a GraphicsLayer if (Target != null && Target is GraphicsLayer) { // Check whether a title expression has been defined if (string.IsNullOrEmpty(TitleExpression)) { // No title expression, so auto-initialize popups // If the target layer is a feature layer, check whether the service metadata specifies a display field if (Target is FeatureLayer) { FeatureLayer fLayer = (FeatureLayer)Target; // Check if the layer's metadata defines a display field if (fLayer.LayerInfo != null && !string.IsNullOrEmpty(fLayer.LayerInfo.DisplayField)) { // use the display field setPopupTitle(fLayer.LayerInfo.DisplayField, fLayer); return; } else if (!fLayer.IsInitialized) { // Wait for the layer to initialize and check again fLayer.Initialized += Layer_Initialized; return; } } // The layer is not a feature layer (i.e. does not have metadata), so auto-determine the display field // based on the graphics in the layer initPopupTitleFromGraphics((GraphicsLayer)Target); } else { // A title expression has been explicitly defined, so use that Dictionary <int, string> expression = new Dictionary <int, string>(); expression.Add(-1, TitleExpression); LayerProperties.SetPopupTitleExpressions(Target, expression); } } }
public LayerPropertiesDialog() : base(Translations.GetString("Layer Properties"), PintaCore.Chrome.MainWindow, DialogFlags.Modal, Core.GtkExtensions.DialogButtonsCancelOk()) { var doc = PintaCore.Workspace.ActiveDocument; Build(); IconName = Resources.Icons.LayerProperties; name = doc.Layers.CurrentUserLayer.Name; hidden = doc.Layers.CurrentUserLayer.Hidden; opacity = doc.Layers.CurrentUserLayer.Opacity; blendmode = doc.Layers.CurrentUserLayer.BlendMode; initial_properties = new LayerProperties( name, hidden, opacity, blendmode); layerNameEntry.Text = initial_properties.Name; visibilityCheckbox.Active = !initial_properties.Hidden; opacitySpinner.Value = (int)(initial_properties.Opacity * 100); opacitySlider.Value = (int)(initial_properties.Opacity * 100); var all_blendmodes = UserBlendOps.GetAllBlendModeNames().ToList(); var index = all_blendmodes.IndexOf(UserBlendOps.GetBlendModeName(blendmode)); blendComboBox.Active = index; layerNameEntry.Changed += OnLayerNameChanged; visibilityCheckbox.Toggled += OnVisibilityToggled; opacitySpinner.ValueChanged += new EventHandler(OnOpacitySpinnerChanged); opacitySlider.ValueChanged += new EventHandler(OnOpacitySliderChanged); blendComboBox.Changed += OnBlendModeChanged; DefaultResponse = Gtk.ResponseType.Ok; layerNameEntry.ActivatesDefault = true; opacitySpinner.ActivatesDefault = true; }
public virtual void LoadProperties(object oldState, bool suppressEvents) { LayerProperties lp = (LayerProperties)oldState; List <string> changed = new List <String>(); if (!suppressEvents) { if (lp.name != properties.name) { changed.Add(LayerProperties.NameName); } if (lp.isBackground != properties.isBackground) { changed.Add(LayerProperties.IsBackgroundName); } if (lp.visible != properties.visible) { changed.Add(LayerProperties.VisibleName); } if (lp.opacity != properties.opacity) { changed.Add(LayerProperties.OpacityName); } } foreach (string propertyName in changed) { OnPropertyChanging(propertyName); } properties = (LayerProperties)((LayerProperties)oldState).Clone(); Invalidate(); foreach (string propertyName in changed) { OnPropertyChanged(propertyName); } }
public unsafe static void Main(string[] args) { var p = Marshal.SizeOf(typeof(LayerProperties)); Console.WriteLine("Hello World!" + p); UInt32 pPropertyCount = 0; var result = vkEnumerateInstanceLayerProperties(ref pPropertyCount, null); Console.WriteLine("Count!" + result + " : " + pPropertyCount); LayerProperties[] pProperties = new LayerProperties[pPropertyCount]; var result2 = vkEnumerateInstanceLayerProperties(ref pPropertyCount, pProperties); Console.WriteLine("Count!" + result2 + " : " + pPropertyCount); foreach (var prop in pProperties) { Console.WriteLine(prop.layerName + " - " + prop.description); } }
private void SetLayerVisibility(UserLayer layer, bool visibility) { if (layer != null) { layer.Hidden = !visibility; } var initial = new LayerProperties(layer.Name, visibility, layer.Opacity, layer.BlendMode); var updated = new LayerProperties(layer.Name, !visibility, layer.Opacity, layer.BlendMode); var historyItem = new UpdateLayerPropertiesHistoryItem( "Menu.Layers.LayerProperties.png", (visibility) ? Catalog.GetString("Layer Shown") : Catalog.GetString("Layer Hidden"), PintaCore.Layers.IndexOf(layer), initial, updated); PintaCore.History.PushNewItem(historyItem); //TODO Call this automatically when the layer visibility changes. PintaCore.Workspace.Invalidate(); }
public LayerPropertiesDialog() : base(Mono.Unix.Catalog.GetString("Layer Properties"), PintaCore.Chrome.MainWindow, DialogFlags.Modal, Stock.Cancel, ResponseType.Cancel, Stock.Ok, ResponseType.Ok) { Build(); this.Icon = PintaCore.Resources.GetIcon("Menu.Layers.LayerProperties.png"); name = PintaCore.Layers.CurrentLayer.Name; hidden = PintaCore.Layers.CurrentLayer.Hidden; opacity = PintaCore.Layers.CurrentLayer.Opacity; blendmode = PintaCore.Layers.CurrentLayer.BlendMode; initial_properties = new LayerProperties( name, hidden, opacity, blendmode); layerNameEntry.Text = initial_properties.Name; visibilityCheckbox.Active = !initial_properties.Hidden; opacitySpinner.Value = (int)(initial_properties.Opacity * 100); opacitySlider.Value = (int)(initial_properties.Opacity * 100); var all_blendmodes = UserBlendOps.GetAllBlendModeNames().ToList(); var index = all_blendmodes.IndexOf(UserBlendOps.GetBlendModeName(blendmode)); blendComboBox.Active = index; layerNameEntry.Changed += OnLayerNameChanged; visibilityCheckbox.Toggled += OnVisibilityToggled; opacitySpinner.ValueChanged += new EventHandler(OnOpacitySpinnerChanged); opacitySlider.ValueChanged += new EventHandler(OnOpacitySliderChanged); blendComboBox.Changed += OnBlendModeChanged; AlternativeButtonOrder = new int[] { (int)Gtk.ResponseType.Ok, (int)Gtk.ResponseType.Cancel }; DefaultResponse = Gtk.ResponseType.Ok; layerNameEntry.ActivatesDefault = true; opacitySpinner.ActivatesDefault = true; }
public virtual void LoadProperties(object oldState, bool suppressEvents) { LayerProperties lp = (LayerProperties)oldState; List<string> changed = new List<String>(); if (!suppressEvents) { if (lp.name != properties.name) { changed.Add(LayerProperties.NameName); } if (lp.isBackground != properties.isBackground) { changed.Add(LayerProperties.IsBackgroundName); } if (lp.visible != properties.visible) { changed.Add(LayerProperties.VisibleName); } if (lp.opacity != properties.opacity) { changed.Add(LayerProperties.OpacityName); } } foreach (string propertyName in changed) { OnPropertyChanging(propertyName); } properties = (LayerProperties)((LayerProperties)oldState).Clone(); Invalidate(); foreach (string propertyName in changed) { OnPropertyChanged(propertyName); } }
internal unsafe void EnumerateDeviceLayerProperties(ref uint propertyCount, LayerProperties* properties) { fixed (uint* __propertyCount__ = &propertyCount) { vkEnumerateDeviceLayerProperties(this, __propertyCount__, properties).CheckError(); } }
protected Layer(Layer copyMe) { this.width = copyMe.width; this.height = copyMe.height; this.properties = (LayerProperties)copyMe.properties.Clone(); }
internal static unsafe extern Result vkEnumerateDeviceLayerProperties(PhysicalDevice physicalDevice, uint* propertyCount, LayerProperties* properties);
public Layer(int width, int height) { this.width = width; this.height = height; this.properties = new LayerProperties(null, new NameValueCollection(), true, false, 255); }
internal static unsafe void EnumerateInstanceLayerProperties(ref uint propertyCount, LayerProperties* properties) { fixed (uint* __propertyCount__ = &propertyCount) { vkEnumerateInstanceLayerProperties(__propertyCount__, properties).CheckError(); } }
internal static unsafe extern Result vkEnumerateInstanceLayerProperties(uint* propertyCount, LayerProperties* properties);