Beispiel #1
0
 public DNGridArea(pLayer layer)
     : base(layer)
 {
     busiDesc              = new DescData();
     thisDesc._objType     = EObjectType.网格;
     thisDesc._objCategory = EObjectCategory.区域类;
 }
Beispiel #2
0
 void initCutArea()
 {
     if (!root.earth.objManager.zLayers.TryGetValue("停电图层", out cutAreaLayer))
     {
         cutAreaLayer = root.earth.objManager.AddLayer("停电图层", "停电图层", "停电图层");
     }
 }
Beispiel #3
0
 public DNRegion(pLayer layer)
     : base(layer)
 {
     busiDesc              = new DescData();
     thisDesc._objType     = EObjectType.行政区域;
     thisDesc._objCategory = EObjectCategory.区域类;
 }
Beispiel #4
0
 public WpfEarthLibrary.PowerBasicObject CreateByType(pLayer layer)
 {
     Object[] parameters = new Object[1]; // 定义构造函数需要的参数,所有参数都必须为Object
     parameters[0] = layer;
     return((PowerBasicObject)System.Reflection.Assembly.GetExecutingAssembly().CreateInstance(type.FullName, false,
                                                                                               System.Reflection.BindingFlags.Default, null, parameters, null, null));
 }
Beispiel #5
0
 //---------------------------------------------------------------------------------------------------
 ///<summary>创建配网对象</summary>
 PowerBasicObject createDNObject(pLayer player)
 {
     Object[] parameters = new Object[1]; // 定义构造函数需要的参数,所有参数都必须为Object
     parameters[0] = player;
     return((PowerBasicObject)System.Reflection.Assembly.GetExecutingAssembly().CreateInstance(DNObjTypeFullName, false,
                                                                                               System.Reflection.BindingFlags.Default, null, parameters, null, null));
 }
Beispiel #6
0
 public DNMainTransformer3W(pLayer layer)
     : base(layer)
 {
     thisDesc._objType = EObjectType.卷主变;
     symbolid          = ESymbol.绕组变压器.ToString();
     isH = true;
 }
Beispiel #7
0
 public DNSubStation(pLayer layer)
     : base(layer)
 {
     thisDesc._objType = EObjectType.变电站;
     symbolid          = ESymbol.变电站运行.ToString();
     thisDesc._icon    = (System.Windows.Media.Brush)System.Windows.Application.Current.FindResource("通用对象");
 }
Beispiel #8
0
 public DNTransformFacilityBase(pLayer layer)
     : base(layer)
 {
     busiDesc              = new DescData();
     thisDesc._isFacility  = true;
     thisDesc._objCategory = EObjectCategory.变电设施类;
     thisDesc._objScope    = EObjectScope.输配电侧;
 }
Beispiel #9
0
 public DNPlantBase(pLayer layer)
     : base(layer)
 {
     busiDesc              = new DescData();
     thisDesc._isFacility  = true;
     thisDesc._objCategory = EObjectCategory.电厂设施类;
     thisDesc._objScope    = EObjectScope.发电侧;
 }
Beispiel #10
0
 public DNSupportBase(pLayer layer)
     : base(layer)
 {
     busiDesc = new DescData();
     thisDesc._isEquipment = true;
     thisDesc._objCategory = EObjectCategory.杆塔类;
     thisDesc._objScope    = EObjectScope.输配电侧;
 }
Beispiel #11
0
        void initContour()
        {
            if (!root.earth.objManager.zLayers.TryGetValue("负荷等值图层", out containerLayer))
            {
                root.earth.objManager.AddLayer("负荷等值图层", "负荷等值图层", "负荷等值图层");
                containerLayer = root.earth.objManager.zLayers["负荷等值图层"];
            }
            //=========
            double minx, miny, maxx, maxy;

            miny = dots.Min(p => p.location.X); maxy = dots.Max(p => p.location.X);  //将经度换为X坐标, 纬度换为Y坐标
            minx = dots.Min(p => p.location.Y); maxx = dots.Max(p => p.location.Y);
            double w = maxx - minx; double h = maxy - miny;

            minx = minx - w * 0.2; maxx = maxx + w * 0.2;
            miny = miny - h * 0.2; maxy = maxy + h * 0.2;
            w    = maxx - minx; h = maxy - miny;
            //经纬换为屏幕坐标
            int size = 1024;

            foreach (ContourGraph.ValueDot dot in dots)
            {
                dot.location = new Point((dot.location.Y - minx) / w * size, (maxy - dot.location.X) / h * size);  //重新赋与新的平面点位置, 注,纬度取反,仅适用北半球
            }
            double maxvalue = dots.Max(p => p.value);

            //设置计算参数
            con               = new ContourGraph.Contour();
            con.dots          = dots;
            con.opacityType   = ContourGraph.Contour.EOpacityType.正坡形;
            con.opacityRange  = 0.9;
            con.minOpacity    = 0.3;
            con.maxOpacity    = 1;
            con.canvSize      = new Size(size, size);
            con.gridXCount    = 200;
            con.gridYCount    = 200;
            con.Span          = 30;
            con.maxvalue      = maxvalue * 0.9;
            con.minvalue      = 0;
            con.dataFillValue = 0;
            con.dataFillMode  = ContourGraph.Contour.EFillMode.八角点包络填充;
            con.isDrawGrid    = false;
            con.isDrawLine    = false;
            con.isFillLine    = true;

            gcon = new pContour(containerLayer)
            {
                id = "负荷等值图"
            };                                                   // { minJD = minx, maxJD = maxx, minWD = miny, maxWD = maxy };
            gcon.setRange(minx, maxx, miny, maxy);
            gcon.brush = con.ContourBrush;
            containerLayer.AddObject("负荷等值图", gcon);

            con.GenCompleted += new EventHandler(con_GenCompleted);
            con.GenContourAsync(); //异步开始生成

            root.earth.UpdateModel();
        }
Beispiel #12
0
 public DNBusBarSwitch(pLayer layer)
     : base(layer)
 {
     busiDesc = new DescData();
     thisDesc._isEquipment = true;
     thisDesc._objType     = EObjectType.母联;
     thisDesc._objCategory = EObjectCategory.开关类;
     thisDesc._objScope    = EObjectScope.输配电侧;
 }
Beispiel #13
0
 public DNDividingBox(pLayer layer)
     : base(layer)
 {
     busiDesc              = new DescData();
     thisDesc._isFacility  = true;
     thisDesc._objType     = EObjectType.分界箱;
     thisDesc._objCategory = EObjectCategory.其它类;
     thisDesc._objScope    = EObjectScope.输配电侧;
     symbolid              = ESymbol.分界箱.ToString();
 }
Beispiel #14
0
 public DNSwitchStation(pLayer layer)
     : base(layer)
 {
     busiDesc              = new DescData();
     thisDesc._isFacility  = true;
     thisDesc._objType     = EObjectType.开关站;
     thisDesc._objCategory = EObjectCategory.开关设施类;
     thisDesc._objScope    = EObjectScope.输配电侧;
     symbolid              = ESymbol.开关站运行.ToString();
 }
Beispiel #15
0
 public DNSubstationOutline(pLayer layer)
     : base(layer)
 {
     busiDesc = new DescData();
     thisDesc._isEquipment = true;
     thisDesc._isFacility  = true;
     thisDesc._objType     = EObjectType.变电站出线;
     thisDesc._objCategory = EObjectCategory.其它类;
     thisDesc._objScope    = EObjectScope.输配电侧;
 }
Beispiel #16
0
 public DNConnectivityNode(pLayer layer)
     : base(layer)
 {
     busiDesc = new DescData();
     thisDesc._isEquipment = true;
     thisDesc._objType     = EObjectType.连接点;
     thisDesc._objCategory = EObjectCategory.其它类;
     thisDesc._objScope    = EObjectScope.输配电侧;
     symbolid = ESymbol.小圆圈.ToString();
 }
Beispiel #17
0
        public DNTransformerBase(pLayer layer)
            : base(layer)
        {
            busiDesc = new DescData();
            thisDesc._isEquipment = true;
            thisDesc._objCategory = EObjectCategory.变压器类;
            thisDesc._objScope    = EObjectScope.输配电侧;

            symbolid = ESymbol.双绕组变压器.ToString();
            isH      = true;
        }
Beispiel #18
0
        /////<summary>注册可用项,注:已不使用,改为自动获取</summary>
        //public void regCanCreateItem(Type type, string dbopkey)
        //{
        //    pLayer tmplayer = new pLayer(null);
        //    DNDesc dn = new DNDesc() { type = type };
        //    PowerBasicObject o = dn.CreateByType(tmplayer);
        //    DescData dd = o.busiDesc as DescData;
        //    dn.sort = dd.objCategory.ToString();
        //    dn.name = type.Name;
        //    dn.dbopkey = dbopkey;
        //    dn.icon = dd.icon;

        //    dn.info = string.Format("{0}({1})", dbopkey, dn.name);
        //    dndescs.Add(dn);

        //}


        void reg(string fulltypename, string dbopkey)
        {
            pLayer tmplayer = new pLayer(null);
            DNDesc dn       = new DNDesc()
            {
                typefullname = fulltypename
            };
            PowerBasicObject o  = dn.CreateByTypeName(tmplayer);
            DescData         dd = o.busiDesc as DescData;

            dn.sort    = dd.objCategory.ToString();
            dn.type    = o.GetType();
            dn.name    = dbopkey; //dn.type.Name;
            dn.dbopkey = dbopkey;
            dn.icon    = dd.icon;

            dn.info = string.Format("{0}({1})", dbopkey, dn.type.Name);//dn.name);
            dndescs.Add(dn);
        }
Beispiel #19
0
        ///<summary>删除对象</summary>
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult mbr = MessageBox.Show("操作将从数据库中真正删除该对象且不可恢复,\r\n请选择【确定】(删除)或【取消】(取消删除)?", "删除确认!", System.Windows.MessageBoxButton.OKCancel, System.Windows.MessageBoxImage.Warning);

            if (mbr == MessageBoxResult.OK)
            {
                btnCreate.IsEnabled   = true;
                btnDelete.IsEnabled   = false;
                btnSave.IsEnabled     = isModify = false;
                btnExit.IsEnabled     = false;
                pgAcnt.SelectedObject = null;
                //数据库操作
                if (editobj != null)
                {
                    string dbopkey = editobj.DBOPKey;
                    //SQL sql = dbdesc.SQLS.FirstOrDefault(p => p.key == dbopkey);
                    SQL sql = dbdesc.Values.SelectMany(p => p.SQLS.Where(pp => pp.key == dbopkey)).FirstOrDefault();
                    if (sql != null)
                    {
                        editobj.id   = (editobj.busiAccount as AcntDataBase).id;
                        editobj.name = (editobj.busiAccount as AcntDataBase).name;
                        sql.delKeyAcnt(oldID);
                    }
                }
                //对象操作
                pLayer pl = editobj.parent;
                pl.pModels.Remove(editobj.id);

                btnAddDot.Visibility  = btnDelDot.Visibility = System.Windows.Visibility.Collapsed;
                btnCreate.IsEnabled   = true;
                btnDelete.IsEnabled   = false;
                btnSave.IsEnabled     = isModify = false;
                btnExit.IsEnabled     = false;
                pgAcnt.SelectedObject = null;
                editobj = assobj = null;

                elayer.pModels.Clear();
                distnet.scene.UpdateModel();
                isModify = false;
            }
        }
Beispiel #20
0
        ///<summary>
        ///根据dbopkey取得的数据库描述定义,批量创建对象载入到distnet中,同时读入台账数据和拓扑数据。
        ///以对象的大类名为层名
        ///若同层同ID对象已存在,则忽略
        ///addwhere为附加到selectAll的附加过滤语句
        ///layername为创建对象时可指定层名称,若为空则以对象所属大类为类名称
        ///返回创建对象列表,供附加其它设置
        ///</summary>
        public List <PowerBasicObject> batchCreateDNObjects(DistNet distnet, string addwhere = "", string layername = null)
        {
            MyBaseControls.Screen.ScreenProgress.info = string.Format("载入{0}...", this.key);

            DataLayer.DataProvider.curDataSourceName = dbdesc.datasourceName;

            List <PowerBasicObject> result = new List <PowerBasicObject>();

            PowerBasicObject obj;
            pLayer           player;
            string           s  = acntSelectAll + " " + addwhere;
            DataTable        dt = DataLayer.DataProvider.getDataTableFromSQL(s);

            if (dt.Rows.Count > 0)
            {
                if (string.IsNullOrWhiteSpace(layername))
                {
                    pLayer tmplayer = new pLayer(null);
                    obj    = createDNObject(tmplayer);
                    player = distnet.addLayer((obj.busiDesc as DescData).objCategory.ToString());
                }
                else
                {
                    player = distnet.addLayer(layername);
                }

                //批量创建对象
                foreach (DataRow dr in dt.Rows)
                {
                    //string zid = dr.getString(this.acntTableRelation.mainTable.keyFieldName);
                    string zid = dr.getString(this.keypdesces.FirstOrDefault(p => p.propertyname == "ID").fieldname);
                    if (string.IsNullOrWhiteSpace(zid))
                    {
                        MyBaseControls.StatusBarTool.StatusBarTool.reportInfo.showInfo("存在设备ID为空的对象,这些对象未被创建,请检查数据来源!", 30);
                        MyBaseControls.LogTool.Log.addLog(string.Format("{1}存在设备ID为空的对象,这些对象未被创建。({0})", this, this.key), MyBaseControls.LogTool.ELogType.告警);
                        continue;  //若设备id为空,不创建对象
                    }

                    bool isExist = false;
                    foreach (pLayer lay in player.parent.zLayers.Values)
                    {
                        isExist = lay.pModels.ContainsKey(zid);
                        if (isExist)
                        {
                            MyBaseControls.StatusBarTool.StatusBarTool.reportInfo.showInfo("存在相同ID的对象,只创建第一个对象,请检查数据来源!", 30);
                            MyBaseControls.LogTool.Log.addLog(string.Format("{1}存在相同ID的对象,只创建第一个对象,请检查数据来源。({0})", this, this.key), MyBaseControls.LogTool.ELogType.告警);
                            break;
                        }
                    }
                    if (!isExist)  //没有同ID对象,才创建
                    {
                        obj         = createDNObject(player);
                        obj.DBOPKey = key;
                        loadKeyAcnt(dr, obj);
                        player.AddObject(obj);
                        result.Add(obj);
                    }
                }
                loadExTopo(result); //载入扩展拓扑
            }
            return(result);
        }
Beispiel #21
0
 public DNStrainSupport(pLayer layer)
     : base(layer)
 {
     thisDesc._objType = EObjectType.耐张杆塔;
     symbolid          = ESymbol.运行杆塔耐张型.ToString();
 }
Beispiel #22
0
 public DNIntermediateSupport(pLayer layer)
     : base(layer)
 {
     thisDesc._objType = EObjectType.直线杆塔;
     symbolid          = ESymbol.运行杆塔直线型.ToString();
 }
Beispiel #23
0
 public DNFuse(pLayer layer)
     : base(layer)
 {
     thisDesc._objType = EObjectType.熔断器;
     symbolid          = ESymbol.熔断器.ToString();
 }
Beispiel #24
0
 public DNBreaker(pLayer layer)
     : base(layer)
 {
     thisDesc._objType = EObjectType.断路器;
     symbolid          = ESymbol.断路器合.ToString();
 }
Beispiel #25
0
 public DNLoadSwitch(pLayer layer)
     : base(layer)
 {
     thisDesc._objType = EObjectType.负荷开关;
     symbolid          = ESymbol.负荷开关合.ToString();
 }
Beispiel #26
0
 public DNSwitchHouse(pLayer layer)
     : base(layer)
 {
     thisDesc._objType = EObjectType.配电室;
     symbolid          = ESymbol.配电室.ToString();
 }
Beispiel #27
0
 public DNConnectivityLine(pLayer layer)
     : base(layer)
 {
     thisDesc._objType = EObjectType.连接线;
 }
Beispiel #28
0
 public DNFeeder(pLayer layer)
     : base(layer)
 {
     thisDesc._isFacility = true;
     thisDesc._objType    = EObjectType.馈线;
 }
Beispiel #29
0
 public DNCableSeg(pLayer layer)
     : base(layer)
 {
     thisDesc._isFacility = true;
     thisDesc._objType    = EObjectType.电缆段;
 }
Beispiel #30
0
 public DNLineSeg(pLayer layer)
     : base(layer)
 {
     thisDesc._isFacility = true;
     thisDesc._objType    = EObjectType.导线段;
 }