public Graphic(GraphicTypes _graphicType, string _uniqueid, IGeometry _geometry, bool _isTemp = false) { GraphicType = _graphicType; UniqueId = _uniqueid; Geometry = _geometry; IsTemp = _isTemp; }
/// <summary> /// Standardowy konstruktor dla GraphicsEditor. /// </summary> /// <param name="projectForThisGraphics">Projekt dla tego edytora graficznego. Może być pusty.</param> /// <param name="toolboxForThisEditor">Toolbox z którego ten edytor będzie pobierać informacje.</param> /// <param name="type">Typ tej grafiki.</param> /// <param name="log">Log dla tego edytora graficznego.</param> /// <param name="plusParams">Dodatkowe parametry zależne od typu grafiki.</param> public GraphicsEditor(IProject projectForThisGraphics, IToolbox toolboxForThisEditor, GraphicTypes type, ILog log, INotificator notificator, object[] plusParams) { // Wywalanie wyjątków. if (log == null && notificator == null) { throw new NullReferenceException("log i notificator są puste"); } else if (log == null) { Exception error = new NullReferenceException(Factory.GetProgrammerErrorString("log nie może być pusty.", true)); notificator.Notify(error); throw error; } else if (notificator == null) { Exception error = new NullReferenceException(Factory.GetProgrammerErrorString("notificator nie może być pusty.", true)); log.Write(error.Message); throw error; } else if (toolboxForThisEditor == null) { throw new NullReferenceException("Toolbox nie może być pusty."); } log.Write(Factory.GetNewInstanceCreationString("GraphicsEditor"), LogMessagesTypes.Detail); // Inicjalizacja komponentów. InitializeComponent(); // Przypisywanie. this.notificator = notificator; this.log = log; standardEditor = Graphic = new Graphic(projectForThisGraphics, pcbWorkSpace.CreateGraphics(), log); toolbox = toolboxForThisEditor; Project = projectForThisGraphics; Type = type; // Tworzenie Menu Głównego. MainMenu mainMenu = new MainMenu(); MenuItem fileItem = new MenuItem("Plik"); MenuItem newItem = new MenuItem("Nowy", newItem_Click); MenuItem saveItem = new MenuItem("Zapisz", saveItem_Click); MenuItem graphicItem = new MenuItem("Grafika"); MenuItem addImageItem = new MenuItem("Dodaj zdjęcie", addImageItem_Click); mainMenu.MenuItems.Add(fileItem); fileItem.MenuItems.Add(newItem); fileItem.MenuItems.Add(saveItem); mainMenu.MenuItems.Add(graphicItem); graphicItem.MenuItems.Add(addImageItem); Menu = mainMenu; // Instrukcje dla PixelArt'ów. if (type == GraphicTypes.PixelArt) { SetWorkSpaceSize(new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height)); sizeOfPixelArt = (int)plusParams[0]; DrawLinesForPixelArt(); } }
public Graphic(GraphicTypes _graphicType, string _uniqueid, IGeometry _geometry, TabBaseViewModel _model, bool _isTemp = false) { GraphicType = _graphicType; UniqueId = _uniqueid; Geometry = _geometry; IsTemp = _isTemp; ViewModel = _model; }
public Graphic(GraphicTypes _graphicType, IDisposable _disposable, Geometry _geometry, bool _isTemp = false) { GraphicType = _graphicType; //UniqueId = _uniqueid; Disposable = _disposable; Geometry = _geometry; IsTemp = _isTemp; }
public Graphic(GraphicTypes _graphicType, IDisposable _disposable, Geometry _geometry, ProTabBaseViewModel _viewModel, bool _isTemp = false) { GraphicType = _graphicType; //UniqueId = _uniqueid; Disposable = _disposable; Geometry = _geometry; IsTemp = _isTemp; ViewModel = _viewModel; }
public Graphic(GraphicTypes _graphicType, string _uniqueid, IGeometry _geometry, TabBaseViewModel _model, bool _isTemp = false, IDictionary <string, System.Object> attributes = null) { GraphicType = _graphicType; UniqueId = _uniqueid; Geometry = _geometry; IsTemp = _isTemp; ViewModel = _model; Attributes = attributes; }
public bool ConvertLayerToKML(string kmzOutputPath, string tmpShapefilePath, ESRI.ArcGIS.Carto.IMap map, GraphicTypes graphicType) { try { string kmzName = System.IO.Path.GetFileName(kmzOutputPath); IGeoProcessor2 gp = new GeoProcessorClass(); gp.OverwriteOutput = true; IGeoFeatureLayer geoLayer = null; IVariantArray parameters = new VarArrayClass(); parameters.Add(tmpShapefilePath); parameters.Add(kmzName); gp.Execute("MakeFeatureLayer_management", parameters, null); string layerFileName = getLayerFileFromGraphicType(graphicType); if (!string.IsNullOrEmpty(layerFileName)) { IVariantArray parametersASM = new VarArrayClass(); parametersASM.Add(kmzName); parametersASM.Add(layerFileName); gp.Execute("ApplySymbologyFromLayer_management", parametersASM, null); } IVariantArray parameters1 = new VarArrayClass(); // assign parameters parameters1.Add(kmzName); parameters1.Add(kmzOutputPath); gp.Execute("LayerToKML_conversion", parameters1, null); // Remove the temporary layer from the TOC for (int i = 0; i < map.LayerCount; i++) { ILayer layer = map.get_Layer(i); if ((layer.Name == "featureLayer") || (layer.Name == kmzName)) { map.DeleteLayer(layer); break; } } if (geoLayer != null) { map.DeleteLayer(geoLayer); } return(true); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return(false); } }
/// <summary> /// Ustawia layout do typu. /// </summary> /// <param name="t">Typ.</param> private void SetLayout(GraphicTypes t) { switch (t) { case GraphicTypes.Empty: lblWidth.Visible = true; lblHeight.Visible = true; lblPathToImage.Visible = false; lblWidthOfSelectedImage.Visible = false; lblHeightOfSelectedImage.Visible = false; lblSizeOfPixelArt.Visible = false; lblSizePerPixel.Visible = false; txtWidth.Visible = true; txtHeight.Visible = true; btnSelectImage.Visible = false; cmbSizeOfPixelArt.Visible = false; nudSizePerPixel.Visible = false; log.Write("NewGraphicForm layout jest od teraz Empty.", LogMessagesTypes.Important); break; case GraphicTypes.Image: lblWidth.Visible = false; lblHeight.Visible = false; lblPathToImage.Visible = true; lblWidthOfSelectedImage.Visible = true; lblHeightOfSelectedImage.Visible = true; lblSizeOfPixelArt.Visible = false; lblSizePerPixel.Visible = false; txtWidth.Visible = false; txtHeight.Visible = false; btnSelectImage.Visible = true; cmbSizeOfPixelArt.Visible = false; nudSizePerPixel.Visible = false; log.Write("NewGraphicForm layout jest od teraz Image.", LogMessagesTypes.Important); break; case GraphicTypes.PixelArt: lblWidth.Visible = false; lblHeight.Visible = false; lblPathToImage.Visible = false; lblWidthOfSelectedImage.Visible = false; lblHeightOfSelectedImage.Visible = false; lblSizeOfPixelArt.Visible = true; lblSizePerPixel.Visible = true; txtWidth.Visible = false; txtHeight.Visible = false; btnSelectImage.Visible = false; cmbSizeOfPixelArt.Visible = true; nudSizePerPixel.Visible = true; log.Write("NewGraphicForm layout jest od teraz PixelArt.", LogMessagesTypes.Important); break; } }
private string getLayerFileFromGraphicType(GraphicTypes graphicType) { var asm = System.Reflection.Assembly.GetExecutingAssembly(); string addinPath = System.IO.Path.GetDirectoryName( Uri.UnescapeDataString( new Uri(asm.CodeBase).LocalPath)); string layerFileName = string.Empty; switch (graphicType) { case GraphicTypes.Line: layerFileName = "Lines.lyr"; break; case GraphicTypes.RangeRing: layerFileName = "Rings.lyr"; break; case GraphicTypes.Circle: layerFileName = "Circles.lyr"; break; case GraphicTypes.Ellipse: layerFileName = "Ellipses.lyr"; break; default: break; } if (string.IsNullOrEmpty(layerFileName)) { return(layerFileName); } string layerPath = System.IO.Path.Combine(addinPath, "Data", layerFileName); return(layerPath); }
private void cmbGraphicType_SelectedIndexChanged(object sender, EventArgs e) { switch (cmbGraphicType.Text) { case "Pusta": type = GraphicTypes.Empty; break; case "Zdjęcie": type = GraphicTypes.Image; break; case "Piksel Art": type = GraphicTypes.PixelArt; break; default: notificator.Notify((new Exception(Factory.GetProgrammerErrorString("Nie wykryto typu nowej grafiki.", false))).Message); break; } SetLayout(type); }
static public GraphicsEditor ShowGraphicsEditor(Size size, IProject project, IToolbox toolbox, GraphicTypes type, ILog log, INotificator notificator, object[] plusParams) { GraphicsEditor form = new GraphicsEditor(project, toolbox, type, log, notificator, plusParams); form.Show(); form.FormClosed += OpenForm_FormClosed; openForms.Add(form); form.SetWorkSpaceSize(size); return(form); }
static public GraphicsEditor ShowGraphicsEditor(Size size, IProject project, IToolbox toolbox, GraphicTypes type, object[] plusParams) { return(ShowGraphicsEditor(size, project, toolbox, type, StandardLog, StandardNotificator, plusParams)); }
static public GraphicsEditor ShowGraphicsEditor(Size size, IProject project, GraphicTypes type, object[] plusParams) { return(ShowGraphicsEditor(size, project, GetToolboxForm().MainToolbox, type, plusParams)); }
private void btnVideo_Click(object sender, EventArgs e) { errProv.Dispose(); try { if (txtFileSamp.Text == "") { throw new Exception("No file chosen."); } else if (!File.Exists(txtFileSamp.Text)) { throw new Exception("That file does not exist, and thus can't be ran."); } string ext = Path.GetExtension(txtFileSamp.Text); if (VideoTypes.Contains(ext.ToLower())) { Video videoFile = new Video(txtFileSamp.Text); videoFile.ViewFile(); } else if (GraphicTypes.Contains(ext.ToLower())) { Graphic graphicFile = new Graphic(txtFileSamp.Text); graphicFile.ViewFile(); } else if (AudioTypes.Contains(ext.ToLower())) { Audio audioFile = new Audio(txtFileSamp.Text); audioFile.ViewFile(); } else if (ArchiveTypes.Contains(ext.ToLower())) { Archive archiveFile = new Archive(txtFileSamp.Text); archiveFile.ViewFile(); } else if (DocumentTypes.Contains(ext.ToLower())) { Document docFile = new Document(txtFileSamp.Text); docFile.ViewFile(); } else { throw new Exception("File type not found: the chosen file type is not supported."); //System.IO.FileInfo newFile = new System.IO.FileInfo(txtFileSamp.Text); //System.IO.FileAttributes b = newFile.Attributes; } } catch (Exception ex) { errProv.SetError(btnDisplay, ex.Message); } }