예제 #1
0
        public void AddObject(string objtname, int x, int y)
        {
            string     prep;
            var        count   = FlowsheetObject.SimulationObjects.Count;
            ObjectType objtype = ObjectType.Nenhum;

            if (objtype == ObjectType.Nenhum)
            {
                if (objtname == "Text")
                {
                    var gobj = new DWSIM.Drawing.SkiaSharp.GraphicObjects.TextGraphic(x, y, "TEXT");
                    gobj.Name = Guid.NewGuid().ToString();
                    FlowsheetObject.AddGraphicObject(gobj);
                }
                else if (objtname == "Property Table")
                {
                    var gobj = new DWSIM.Drawing.SkiaSharp.GraphicObjects.Tables.TableGraphic(x, y);
                    gobj.Name      = Guid.NewGuid().ToString();
                    gobj.Flowsheet = FlowsheetObject;
                    FlowsheetObject.AddGraphicObject(gobj);
                }
                else if (objtname == "Spreadsheet Table")
                {
                    var gobj = new DWSIM.Drawing.SkiaSharp.GraphicObjects.Tables.SpreadsheetTableGraphic(x, y);
                    gobj.Name      = Guid.NewGuid().ToString();
                    gobj.Flowsheet = FlowsheetObject;
                    FlowsheetObject.AddGraphicObject(gobj);
                }
                else if (objtname == "Master Property Table")
                {
                    var gobj = new DWSIM.Drawing.SkiaSharp.GraphicObjects.Tables.MasterTableGraphic(x, y);
                    gobj.Name      = Guid.NewGuid().ToString();
                    gobj.Flowsheet = FlowsheetObject;
                    FlowsheetObject.AddGraphicObject(gobj);
                }
                else if (objtname == "Chart Object")
                {
                    var gobj = new DWSIM.Drawing.SkiaSharp.GraphicObjects.Charts.OxyPlotGraphic(x, y);
                    gobj.Name      = Guid.NewGuid().ToString();
                    gobj.Flowsheet = FlowsheetObject;
                    FlowsheetObject.AddGraphicObject(gobj);
                }
            }
            Invalidate();
        }
예제 #2
0
        public void AddObject(string objtname, int x, int y)
        {
            string     prep;
            var        count   = FlowsheetObject.SimulationObjects.Count;
            ObjectType objtype = ObjectType.Nenhum;

            switch (objtname)
            {
            case "Material Stream":
                objtype = ObjectType.MaterialStream;
                prep    = "MSTR-";
                break;

            case "Energy Stream":
                objtype = ObjectType.EnergyStream;
                prep    = "ESTR-";
                break;

            case "Vessel":
                objtype = ObjectType.Vessel;
                prep    = "SEP-";
                break;

            case "Mixer":
                objtype = ObjectType.NodeIn;
                prep    = "MIX-";
                break;

            case "Splitter":
                objtype = ObjectType.NodeOut;
                prep    = "SPL-";
                break;

            case "Pump":
                objtype = ObjectType.Pump;
                prep    = "PUMP-";
                break;

            case "Valve":
                objtype = ObjectType.Valve;
                prep    = "VALV-";
                break;

            case "Heat Exchanger":
                objtype = ObjectType.HeatExchanger;
                prep    = "HXC-";
                break;

            case "Heater/Cooler":
                objtype = ObjectType.HeaterCooler;
                prep    = "HCR-";
                break;

            case "Compressor/Expander":
                objtype = ObjectType.CompressorExpander;
                prep    = "CXR-";
                break;

            case "Recycle":
                objtype = ObjectType.OT_Recycle;
                prep    = "REC-";
                break;

            case "Shortcut Column":
                objtype = ObjectType.ShortcutColumn;
                prep    = "SCN-";
                break;

            case "Compound Separator":
                objtype = ObjectType.ComponentSeparator;
                prep    = "CS-";
                break;

            case "Conversion Reactor":
                objtype = ObjectType.RCT_Conversion;
                prep    = "CR-";
                break;

            case "Equilibrium Reactor":
                objtype = ObjectType.RCT_Equilibrium;
                prep    = "ER-";
                break;

            case "Gibbs Reactor":
                objtype = ObjectType.RCT_Gibbs;
                prep    = "GR-";
                break;

            case "CSTR":
                objtype = ObjectType.RCT_CSTR;
                prep    = "CSTR-";
                break;

            case "PFR":
                objtype = ObjectType.RCT_PFR;
                prep    = "PFR-";
                break;

            case "Distillation Column":
                objtype = ObjectType.DistillationColumn;
                prep    = "DC-";
                break;

            case "Absorption Column":
                objtype = ObjectType.AbsorptionColumn;
                prep    = "AC-";
                break;

            case "Pipe Segment":
                objtype = ObjectType.Pipe;
                prep    = "PIPE-";
                break;

            case "Adjust":
                objtype = ObjectType.OT_Adjust;
                prep    = "ADJ-";
                break;

            case "Solids Separator":
                objtype = ObjectType.SolidSeparator;
                prep    = "SS-";
                break;

            default:
                objtype = ObjectType.Nenhum;
                prep    = "";
                break;
            }
            if (objtype == ObjectType.Nenhum)
            {
                if (objtname == "Text")
                {
                    var gobj = new DWSIM.Drawing.SkiaSharp.GraphicObjects.TextGraphic(x, y, "TEXT");
                    gobj.Name = Guid.NewGuid().ToString();
                    FlowsheetObject.AddGraphicObject(gobj);
                }
                else if (objtname == "Property Table")
                {
                    var gobj = new DWSIM.Drawing.SkiaSharp.GraphicObjects.Tables.TableGraphic(x, y);
                    gobj.Name      = Guid.NewGuid().ToString();
                    gobj.Flowsheet = FlowsheetObject;
                    FlowsheetObject.AddGraphicObject(gobj);
                }
                else if (objtname == "Spreadsheet Table")
                {
                    var gobj = new DWSIM.Drawing.SkiaSharp.GraphicObjects.Tables.SpreadsheetTableGraphic(x, y);
                    gobj.Name      = Guid.NewGuid().ToString();
                    gobj.Flowsheet = FlowsheetObject;
                    FlowsheetObject.AddGraphicObject(gobj);
                }
                else if (objtname == "Master Property Table")
                {
                    var gobj = new DWSIM.Drawing.SkiaSharp.GraphicObjects.Tables.MasterTableGraphic(x, y);
                    gobj.Name      = Guid.NewGuid().ToString();
                    gobj.Flowsheet = FlowsheetObject;
                    FlowsheetObject.AddGraphicObject(gobj);
                }
                else if (objtname == "Chart Object")
                {
                    var gobj = new DWSIM.Drawing.SkiaSharp.GraphicObjects.Charts.OxyPlotGraphic(x, y);
                    gobj.Name      = Guid.NewGuid().ToString();
                    gobj.Flowsheet = FlowsheetObject;
                    FlowsheetObject.AddGraphicObject(gobj);
                }
            }
            else
            {
                FlowsheetObject.AddObject(objtype, x, y, prep + (count + 1).ToString("000"));
            }
            Invalidate();
        }