/// <summary>
        /// 获取完整的园区初始化xml
        /// </summary>
        /// <param name="floor"></param>
        /// <param name="parkName"></param>
        /// <returns></returns>
        public static InitInfo CreateParkInitInfoByFloors(string parkName, string buildingName, params TopoInfo[] floors)
        {
            InitInfo initInfo = new InitInfo();
            TopoInfo root     = new TopoInfo("根节点", AreaTypes.区域);

            initInfo.TopoInfo = root;

            TopoInfo park = new TopoInfo(parkName, AreaTypes.园区);//todo:可以扩展成园区、大楼手动设置

            root.AddChild(park);

            TopoInfo group = new TopoInfo("生产区域", AreaTypes.分组);//todo:可以扩展成园区、大楼手动设置

            park.AddChild(group);

            TopoInfo building = CreateBuildingInitInfoByFloors(buildingName, floors);

            group.AddChild(building);

            BoundInfo parkBound = building.BoundInfo.CloneByXml();

            parkBound.SetRectangle();
            parkBound.Scale(2);//园区默认是比大楼周围一圈
            park.BoundInfo            = parkBound;
            park.BoundInfo.IsRelative = false;

            return(initInfo);
        }
 private void SetInitBound(BoundInfo boundInfo, Area chidNode)
 {
     if (boundInfo != null)
     {
         bool             isRelative = boundInfo.IsRelative;
         float            thickness  = boundInfo.Thickness;
         List <PointInfo> points     = boundInfo.Points;
         if (points != null && points.Count > 0)
         {
             if (points.Count == 4) //四边点
             {
                 SetInitBound(chidNode, points[0].X, points[0].Y, points[2].X, points[2].Y, thickness, isRelative, boundInfo.BottomHeight, boundInfo.IsCreateAreaByData, boundInfo.IsOnAlarmArea, boundInfo.IsOnLocationArea);
             }
             else if (points.Count == 2) //对角点
             {
                 SetInitBound(chidNode, points[0].X, points[0].Y, points[1].X, points[1].Y, thickness, isRelative, boundInfo.BottomHeight, boundInfo.IsCreateAreaByData, boundInfo.IsOnAlarmArea, boundInfo.IsOnLocationArea);
             }
             else //全部点
             {
                 List <Point> ps = new List <Point>();
                 for (int i = 0; i < points.Count; i++)
                 {
                     PointInfo p = points[i];
                     ps.Add(new Point(p.X, p.Y, 0, i));
                 }
                 SetInitBound(chidNode, ps.ToArray(), thickness, isRelative, boundInfo.BottomHeight, boundInfo.IsCreateAreaByData, boundInfo.IsOnAlarmArea, boundInfo.IsOnLocationArea);
             }
         }
     }
 }
Beispiel #3
0
        private static InitInfo CreateInitInfo(TopoInfo floor, string parkName)
        {
            InitInfo initInfo = new InitInfo();
            TopoInfo root     = new TopoInfo("根节点", AreaTypes.区域);

            initInfo.TopoInfo = root;

            TopoInfo park = new TopoInfo(parkName, AreaTypes.园区);//todo:可以扩展成园区、大楼手动设置

            root.AddChild(park);

            //TopoInfo group = new TopoInfo("分组1", AreaTypes.分组);
            //park.AddChild(group);

            TopoInfo building = new TopoInfo("大楼1", AreaTypes.大楼);

            park.AddChild(building);

            building.AddChild(floor);

            BoundInfo buildBound = floor.BoundInfo.CloneByXml();

            buildBound.SetRectangle();       //比例调整
            buildBound.Scale(1.05f);         //比例调整
            building.BoundInfo = buildBound; //大楼默认和楼层一致

            BoundInfo parkBound = building.BoundInfo.CloneByXml();

            parkBound.SetRectangle();
            parkBound.Scale(2);//园区默认是比大楼周围一圈
            park.BoundInfo = parkBound;

            return(initInfo);
        }
        /// <summary>
        /// 获取完整的园区初始化xml
        /// </summary>
        /// <param name="floor"></param>
        /// <param name="parkName"></param>
        /// <returns></returns>
        public static TopoInfo CreateBuildingInitInfoByFloors(string buildingName, params TopoInfo[] floors)
        {
            TopoInfo building = new TopoInfo(buildingName, AreaTypes.大楼);

            //park.AddChild(building);

            if (floors.Length > 0)
            {
                TopoInfo firstFloor = null;
                foreach (var floor in floors)
                {
                    if (firstFloor == null)
                    {
                        firstFloor = floor;
                    }
                    building.AddChild(floor);
                }

                BoundInfo buildBound = firstFloor.BoundInfo.CloneByXml();
                buildBound.SetRectangle();                  //比例调整
                buildBound.Scale(1.05f);                    //比例调整
                building.BoundInfo            = buildBound; //大楼默认和楼层一致
                building.BoundInfo.IsRelative = false;
                //BoundInfo parkBound = building.BoundInfo.CloneByXml();
                //parkBound.SetRectangle();
                //parkBound.Scale(2);//园区默认是比大楼周围一圈
                //park.BoundInfo = parkBound;
            }


            return(building);
        }
Beispiel #5
0
        public static BoundInfo NewBoundInfo()
        {
            BoundInfo boundInfo = new BoundInfo();

            boundInfo.Thickness          = 3500;
            boundInfo.IsRelative         = false; //都是绝对坐标,不然楼层和大楼会有偏移
            boundInfo.IsCreateAreaByData = true;  //必须有
            return(boundInfo);
        }
	public int PlayerWithinRadius(Vector2 playerPos, BoundInfo[] bounds, Vector2 midpoint)
	{
		for(int i = 0; i < bounds.Length; i++)
		{
			if(bounds[i].radius >= Mathf.Abs(Vector2.Distance(playerPos, midpoint)))
			{
				return i;
			}
		}
		return -1;
	}
Beispiel #7
0
	public void Initialize(BoundInfo info, Fixture fix)
	{
		this.myFixture = fix;
		this.info = info;
		this.transform.localScale = new Vector3(info.radius * 2, info.radius * 2, 1);
		this.transform.localPosition = new Vector3 ();
		GetComponent <CircleCollider2D> ().isTrigger = this.info.passable;
		if (!this.info.passable) {
			gameObject.layer = LayerMask.NameToLayer ("Impassable");
		}
	}
Beispiel #8
0
        private static TopoInfo GetTopoInfo(string name, AreaTypes type, params PointInfo[] pis)
        {
            BoundInfo boundInfo = NewBoundInfo();

            boundInfo.Points.AddRange(pis);

            TopoInfo topoInfo = new TopoInfo();

            topoInfo.BoundInfo = boundInfo;
            topoInfo.Name      = name;
            topoInfo.Type      = type;
            return(topoInfo);
        }
Beispiel #9
0
 public Bound(float x1, float y1, float x2, float y2, BoundInfo info) : this()
 {
     SetInitBound(x1, y1, x2, y2, info.BottomHeight, info.Thickness);
     Shape      = 0;
     IsRelative = info.IsRelative;
     if (info.ZeroX != null)
     {
         ZeroX = info.ZeroX.ToFloat();
     }
     if (info.ZeroY != null)
     {
         ZeroY = info.ZeroY.ToFloat();
     }
 }
Beispiel #10
0
 public Bound(Point[] points, BoundInfo info) : this()
 {
     SetInitBound(points, info.BottomHeight, info.Thickness);
     Shape      = 1;
     IsRelative = info.IsRelative;
     if (info.ZeroX != null)
     {
         ZeroX = info.ZeroX.ToFloat();
     }
     if (info.ZeroY != null)
     {
         ZeroY = info.ZeroY.ToFloat();
     }
 }
Beispiel #11
0
        private void SetInitBound(BoundInfo boundInfo, Area chidNode)
        {
            if (boundInfo != null)
            {
                //bool isRelative = boundInfo.IsRelative;
                //float thickness = boundInfo.Thickness;
                List <PointInfo> points = boundInfo.Points;
                if (points != null)
                {
                    var r = false;
                    if (points.Count == 4) //四边点
                    {
                        //r = SetInitBound(chidNode, points[0].X, points[0].Y, points[2].X, points[2].Y, thickness, isRelative, boundInfo.BottomHeight, boundInfo.IsCreateAreaByData, boundInfo.IsOnAlarmArea, boundInfo.IsOnLocationArea);

                        SetInitBoundAsync(chidNode, points[0].X, points[0].Y, points[2].X, points[2].Y, boundInfo);
                    }
                    else if (points.Count == 2) //对角点
                    {
                        //r = SetInitBound(chidNode, points[0].X, points[0].Y, points[1].X, points[1].Y, thickness, isRelative, boundInfo.BottomHeight, boundInfo.IsCreateAreaByData, boundInfo.IsOnAlarmArea, boundInfo.IsOnLocationArea);

                        SetInitBoundAsync(chidNode, points[0].X, points[0].Y, points[1].X, points[1].Y, boundInfo);
                    }
                    else if (points.Count == 0) //没有点
                    {
                        List <Point> ps = new List <Point>();
                        r = SetInitBound(chidNode, ps.ToArray(), boundInfo);
                    }
                    else //全部点
                    {
                        List <Point> ps = new List <Point>();
                        for (int i = 0; i < points.Count; i++)
                        {
                            PointInfo p = points[i];
                            ps.Add(new Point(p.X, p.Y, 0, i));
                        }
                        SetInitBound(chidNode, ps.ToArray(), boundInfo);
                    }
                }
                else//没有点
                {
                    chidNode.IsRelative         = boundInfo.IsRelative;
                    chidNode.IsCreateAreaByData = boundInfo.IsCreateAreaByData;
                    chidNode.IsOnAlarmArea      = boundInfo.IsOnAlarmArea;
                    chidNode.IsOnLocationArea   = boundInfo.IsOnLocationArea;
                    Areas.Edit(chidNode);
                }
            }
        }
Beispiel #12
0
        public bool SetInitBound(Area topo, Point[] points, BoundInfo boundInfo)
        {
            Bound initBound = new Bound(points, boundInfo);
            Bound editBound = new Bound(points, boundInfo);
            var   transfrom = new TransformM(initBound);
            var   b1        = Bounds.Add(initBound);
            var   b2        = Bounds.Add(editBound);

            transfrom.IsCreateAreaByData = boundInfo.IsCreateAreaByData;
            transfrom.IsOnAlarmArea      = boundInfo.IsOnAlarmArea;
            transfrom.IsOnLocationArea   = boundInfo.IsOnLocationArea;
            //TransformMs.Add(transfrom);
            topo.SetTransform(transfrom);
            topo.InitBound = initBound;
            topo.EditBound = editBound;
            var b3 = Areas.Edit(topo);

            return(b1 && b2 && b3);
        }
Beispiel #13
0
        void AddToBounds(BoundInfo bound, int index)
        {
            //
            // Some types cannot be used as type arguments
            //
            if (bound.Type == TypeManager.CoreTypes.Void || bound.Type.IsPointer)
            {
                return;
            }

            ArrayList a = bounds[index];

            if (a == null)
            {
                a             = new ArrayList();
                bounds[index] = a;
            }
            else
            {
                if (a.Contains(bound))
                {
                    return;
                }
            }

            //
            // SPEC: does not cover type inference using constraints
            //
            //if (TypeManager.IsGenericParameter (t)) {
            //    GenericConstraints constraints = TypeManager.GetTypeParameterConstraints (t);
            //    if (constraints != null) {
            //        //if (constraints.EffectiveBaseClass != null)
            //        //	t = constraints.EffectiveBaseClass;
            //    }
            //}
            a.Add(bound);
        }
Beispiel #14
0
            public override bool Equals(object obj)
            {
                BoundInfo a = (BoundInfo)obj;

                return(Type == a.Type && Kind == a.Kind);
            }
Beispiel #15
0
    protected void h(j A_0)
    {
        global::u.c("handleGetElementsBound" + A_0.c);
        List <int>       list  = JsonParser.Deserialization <List <int> >(A_0);
        List <BoundInfo> list2 = new List <BoundInfo>();

        foreach (int current in list)
        {
            GameObject gameObject = GameObjectManager.INSTANCE.FindGameObjectGlobal(current);
            BoundInfo  boundInfo  = new BoundInfo();
            boundInfo.instance = current;
            list2.Add(boundInfo);
            try
            {
                if (gameObject != null)
                {
                    Rectangle rectangle = this.o.d(gameObject);
                    if (rectangle == null)
                    {
                        boundInfo.visible = false;
                    }
                    else
                    {
                        boundInfo.x      = rectangle.x;
                        boundInfo.y      = rectangle.y;
                        boundInfo.width  = rectangle.width;
                        boundInfo.height = rectangle.height;
                        boundInfo.path   = global::g.b(gameObject);
                    }
                }
                else
                {
                    boundInfo.existed = false;
                }
            }
            catch (Exception ex)
            {
                global::u.a(ex.Message + " " + ex.StackTrace);
                boundInfo.visible = false;
            }
        }
        foreach (BoundInfo current2 in list2)
        {
            global::u.c(string.Concat(new object[]
            {
                "Bound width = ",
                current2.width,
                " height = ",
                current2.height,
                " x = ",
                current2.x,
                " y=",
                current2.y,
                " existed = ",
                current2.existed,
                " visible = ",
                current2.visible
            }));
        }
        A_0.b = list2;
        global::o.a(A_0);
    }
Beispiel #16
0
        private async void SetInitBoundAsync(Area topo, float x1, float y1, float x2, float y2, BoundInfo boundInfo)
        {
            Bound initBound = new Bound(x1, y1, x2, y2, boundInfo);
            Bound editBound = new Bound(x1, y1, x2, y2, boundInfo);
            var   transfrom = new TransformM(initBound);
            var   b1        = await Bounds.AddAsync(initBound);

            var b2 = await Bounds.AddAsync(editBound);

            transfrom.IsCreateAreaByData = boundInfo.IsCreateAreaByData;
            transfrom.IsOnAlarmArea      = boundInfo.IsOnAlarmArea;
            transfrom.IsOnLocationArea   = boundInfo.IsOnLocationArea;
            //TransformMs.Add(transfrom);

            topo.SetTransform(transfrom);
            topo.InitBound = initBound;
            topo.EditBound = editBound;
            var b3 = Areas.EditAsync(topo);
            //var b = b1 && b2 && b3;
        }
Beispiel #17
0
		void AddToBounds (BoundInfo bound, int index)
		{
			//
			// Some types cannot be used as type arguments
			//
			if (bound.Type == TypeManager.void_type || bound.Type.IsPointer)
				return;

			var a = bounds [index];
			if (a == null) {
				a = new List<BoundInfo> (2);
				a.Add (bound);
				bounds [index] = a;
				return;
			}

			if (a.Contains (bound))
				return;

			a.Add (bound);
		}
        public static TopoInfo GetOneFloorOpt(string floorLayer)
        {
            //InitInfo initInfo = new InitInfo();

            //TopoInfo root = new TopoInfo("根节点", AreaTypes.区域);
            //initInfo.TopoInfo = root;
            string   floorBoundLayer = floorLayer + "-边界";
            TopoInfo floor           = new TopoInfo(floorLayer, AreaTypes.楼层);//todo:可以扩展成园区、大楼手动设置

            try
            {
                //"园区"
                ShapesDefine parkpoint = GetParkLayerByName(floorBoundLayer, false);
                if (parkpoint.shapelist.Count > 0)
                {
                    List <PointInfo> point = new List <PointInfo>();

                    foreach (CADShape vl in parkpoint.shapelist)
                    {
                        Dictionary <string, int> repoint = new Dictionary <string, int>(); //去除重复的点

                        foreach (CADPoint p in vl.Points)
                        {
                            PointInfo sub = new PointInfo((float)p.X, (float)p.Y);

                            string key = p.X.ToString() + "_" + p.Y.ToString();

                            if (!repoint.ContainsKey(key))
                            {
                                repoint[key] = 1;
                                point.Add(sub);
                            }
                        }
                        break;
                    }
                    BoundInfo boundInfo = GetRoomsCommand.NewBoundInfo();
                    //boundInfo.Points.AddRange(point);
                    List <PointInfo> newpoint = new List <PointInfo>();
                    ToPointFromClockwise(point, ref newpoint);
                    boundInfo.Points.AddRange(newpoint);
                    boundInfo.IsRelative = true;
                    floor.BoundInfo      = boundInfo;
                    floor.Name           = floorLayer;
                    floor.Type           = AreaTypes.楼层;
                }
                //root.AddChild(floor);

                // TopoInfo building = new TopoInfo("大楼", AreaTypes.大楼);
                //  park.AddChild(building);

                ShapesDefine floorpoint = GetParkLayerByName(floorLayer, true);//房间都在楼层的Layer里面

                if (parkpoint.shapelist.Count > 0)
                {
                    foreach (CADShape vl in floorpoint.shapelist)
                    {
                        if (vl.Layer == floorBoundLayer)
                        {
                            //
                            continue;
                        }

                        List <PointInfo>         point   = new List <PointInfo>();
                        Dictionary <string, int> repoint = new Dictionary <string, int>(); //去除重复的点

                        foreach (CADPoint p in vl.Points)
                        {
                            PointInfo sub = new PointInfo((float)p.X, (float)p.Y);
                            string    key = p.X.ToString() + "_" + p.Y.ToString();

                            if (!repoint.ContainsKey(key))
                            {
                                repoint[key] = 1;
                                point.Add(sub);
                            }
                        }
                        //break;

                        if (point.Count > 0)
                        {
                            BoundInfo boundInfo = GetRoomsCommand.NewBoundInfo();
                            //  boundInfo.Points.AddRange(point);
                            boundInfo.IsRelative = false;//这里是true的话,楼层有偏移会导致房间整体偏移。

                            List <PointInfo> newpoint = new List <PointInfo>();
                            ToPointFromClockwise(point, ref newpoint);
                            boundInfo.Points.AddRange(newpoint);

                            TopoInfo topoInfo = new TopoInfo();
                            topoInfo.BoundInfo = boundInfo;
                            topoInfo.Name      = vl.Name;
                            if (vl.Name == "floorLayer")
                            {
                                topoInfo.Name = "机房_NoName";
                            }
                            topoInfo.Type = AreaTypes.机房;


                            floor.AddChild(topoInfo);
                        }
                    }
                }
            }
            catch
            {
            }

            return(floor);
        }
Beispiel #19
0
		void AddToBounds (BoundInfo bound, int index)
		{
			//
			// Some types cannot be used as type arguments
			//
			if (bound.Type == TypeManager.void_type || bound.Type.IsPointer)
				return;

			var a = bounds [index];
			if (a == null) {
				a = new List<BoundInfo> ();
				bounds [index] = a;
			} else {
				if (a.Contains (bound))
					return;
			}

			//
			// SPEC: does not cover type inference using constraints
			//
			//if (TypeManager.IsGenericParameter (t)) {
			//    GenericConstraints constraints = TypeManager.GetTypeParameterConstraints (t);
			//    if (constraints != null) {
			//        //if (constraints.EffectiveBaseClass != null)
			//        //	t = constraints.EffectiveBaseClass;
			//    }
			//}
			a.Add (bound);
		}
        private static InitInfo CreateInitInfo(string parkName, int maxFloorCount)
        {
            InitInfo initInfo = new InitInfo();
            TopoInfo root     = new TopoInfo("根节点", AreaTypes.区域);

            initInfo.TopoInfo = root;

            try
            {
                //"园区"
                ShapesDefine parkpoint = GetParkLayerByName("园区", false);

                TopoInfo park = new TopoInfo(parkName, AreaTypes.园区);//todo:可以扩展成园区、大楼手动设置

                if (parkpoint.shapelist.Count > 0)
                {
                    List <PointInfo> point = new List <PointInfo>();

                    foreach (CADShape vl in parkpoint.shapelist)
                    {
                        Dictionary <string, int> repoint = new Dictionary <string, int>(); //去除重复的点

                        foreach (CADPoint p in vl.Points)
                        {
                            PointInfo sub = new PointInfo((float)p.X, (float)p.Y);

                            string key = p.X.ToString() + "_" + p.Y.ToString();

                            if (!repoint.ContainsKey(key))
                            {
                                repoint[key] = 1;
                                point.Add(sub);
                            }
                        }
                        break;
                    }

                    BoundInfo boundInfo = GetRoomsCommand.NewBoundInfo();

                    List <PointInfo> newpoint = new List <PointInfo>();
                    ToPointFromClockwise(point, ref newpoint);
                    boundInfo.Points.AddRange(newpoint);
                    //boundInfo.Points.AddRange(point);

                    park.BoundInfo = boundInfo;
                    park.Name      = parkName;
                    park.Type      = AreaTypes.园区;
                }

                root.AddChild(park);

                // TopoInfo building = new TopoInfo("大楼", AreaTypes.大楼);
                //  park.AddChild(building);

                ShapesDefine floorpoint = GetParkLayerByName("大楼", true);

                TopoInfo group = new TopoInfo();
                group.Type = AreaTypes.分组;
                group.Name = "生产区域";

                park.AddChild(group);

                if (parkpoint.shapelist.Count > 0)
                {
                    foreach (CADShape vl in floorpoint.shapelist)
                    {
                        List <PointInfo>         point   = new List <PointInfo>();
                        Dictionary <string, int> repoint = new Dictionary <string, int>(); //去除重复的点

                        foreach (CADPoint p in vl.Points)
                        {
                            PointInfo sub = new PointInfo((float)p.X, (float)p.Y);
                            string    key = p.X.ToString() + "_" + p.Y.ToString();

                            if (!repoint.ContainsKey(key))
                            {
                                repoint[key] = 1;
                                point.Add(sub);
                            }
                        }
                        //break;

                        if (point.Count > 0)
                        {
                            List <PointInfo> newpoint = new List <PointInfo>();
                            ToPointFromClockwise(point, ref newpoint);


                            BoundInfo boundInfo = GetRoomsCommand.NewBoundInfo();
                            //boundInfo.Points.AddRange(point);
                            boundInfo.Points.AddRange(newpoint);

                            TopoInfo topoInfo = new TopoInfo();
                            topoInfo.BoundInfo = boundInfo;
                            topoInfo.Name      = vl.Name;
                            topoInfo.Type      = AreaTypes.大楼;
                            group.AddChild(topoInfo);

                            List <TopoInfo> floors = GetFloorList(vl.Name, maxFloorCount);//cww,合并 全厂_大楼_楼层_房间
                            foreach (var floor in floors)
                            {
                                topoInfo.AddChild(floor);
                            }
                        }
                    }
                }
            }
            catch
            {
            }
            root.SetAbsolute();
            return(initInfo);
        }
Beispiel #21
0
        //
        // 26.3.3.10 Fixing
        //
        public bool FixType(ParseContext ec, int i)
        {
            // It's already fixed
            if (unfixed_types[i] == null)
            {
                throw new InternalErrorException("Type argument has been already fixed");
            }

            if (failed)
            {
                return(false);
            }

            ArrayList candidates = (ArrayList)bounds[i];

            if (candidates == null)
            {
                return(false);
            }

            if (candidates.Count == 1)
            {
                unfixed_types[i] = null;
                Type t = ((BoundInfo)candidates[0]).Type;
                if (t == TypeManager.CoreTypes.Null)
                {
                    return(false);
                }

                fixed_types[i] = t;
                return(true);
            }

            //
            // Determines a unique type from which there is
            // a standard implicit conversion to all the other
            // candidate types.
            //
            Type best_candidate   = null;
            int  candidates_count = candidates.Count;

            for (int ci = 0; ci < candidates_count; ++ci)
            {
                BoundInfo bound = (BoundInfo)candidates[ci];
                int       cii;
                for (cii = 0; cii < candidates_count; ++cii)
                {
                    if (cii == ci)
                    {
                        continue;
                    }

                    BoundInfo cbound = (BoundInfo)candidates[cii];

                    // Same type parameters with different bounds
                    if (cbound.Type == bound.Type)
                    {
                        if (bound.Kind != BoundKind.Exact)
                        {
                            bound = cbound;
                        }

                        continue;
                    }

                    if (bound.Kind == BoundKind.Exact || cbound.Kind == BoundKind.Exact)
                    {
                        if (cbound.Kind != BoundKind.Exact)
                        {
                            if (!TypeUtils.IsImplicitlyConvertible(cbound.Type, bound.Type))
                            {
                                break;
                            }

                            continue;
                        }

                        if (bound.Kind != BoundKind.Exact)
                        {
                            if (!TypeUtils.IsImplicitlyConvertible(bound.Type, cbound.Type))
                            {
                                break;
                            }

                            bound = cbound;
                            continue;
                        }

                        break;
                    }

                    if (bound.Kind == BoundKind.Lower)
                    {
                        if (!TypeUtils.IsImplicitlyConvertible(cbound.Type, bound.Type))
                        {
                            break;
                        }
                    }
                    else
                    {
                        if (!TypeUtils.IsImplicitlyConvertible(bound.Type, cbound.Type))
                        {
                            break;
                        }
                    }
                }

                if (cii != candidates_count)
                {
                    continue;
                }

                if (best_candidate != null && best_candidate != bound.Type)
                {
                    return(false);
                }

                best_candidate = bound.Type;
            }

            if (best_candidate == null)
            {
                return(false);
            }

            unfixed_types[i] = null;
            fixed_types[i]   = best_candidate;
            return(true);
        }
        private static InitInfo CreateInitInfo()
        {
            InitInfo initInfo = new InitInfo();
            TopoInfo root     = new TopoInfo("根节点", AreaTypes.区域);

            initInfo.TopoInfo = root;

            try
            {
                //"园区"
                ShapesDefine parkpoint = GetParkLayerByName("园区", false);

                TopoInfo park = new TopoInfo("园区", AreaTypes.园区);//todo:可以扩展成园区、大楼手动设置

                if (parkpoint.shapelist.Count > 0)
                {
                    List <PointInfo> point = new List <PointInfo>();

                    foreach (CADShape vl in parkpoint.shapelist)
                    {
                        foreach (CADPoint p in vl.Points)
                        {
                            PointInfo sub = new PointInfo((float)p.X, (float)p.Y);
                            point.Add(sub);
                        }
                        break;
                    }

                    BoundInfo boundInfo = GetRoomsCommand.NewBoundInfo();
                    boundInfo.Points.AddRange(point);

                    park.BoundInfo = boundInfo;
                    park.Name      = "园区";
                    park.Type      = AreaTypes.园区;
                }

                root.AddChild(park);

                // TopoInfo building = new TopoInfo("大楼", AreaTypes.大楼);
                //  park.AddChild(building);

                ShapesDefine floorpoint = GetParkLayerByName("大楼", true);

                if (parkpoint.shapelist.Count > 0)
                {
                    foreach (CADShape vl in floorpoint.shapelist)
                    {
                        List <PointInfo> point = new List <PointInfo>();

                        foreach (CADPoint p in vl.Points)
                        {
                            PointInfo sub = new PointInfo((float)p.X, (float)p.Y);
                            point.Add(sub);
                        }
                        //break;

                        if (point.Count > 0)
                        {
                            BoundInfo boundInfo = GetRoomsCommand.NewBoundInfo();
                            boundInfo.Points.AddRange(point);

                            TopoInfo topoInfo = new TopoInfo();
                            topoInfo.BoundInfo = boundInfo;
                            topoInfo.Name      = vl.Name;
                            topoInfo.Type      = AreaTypes.大楼;
                            park.AddChild(topoInfo);
                        }
                    }
                }
            }
            catch
            {
            }

            return(initInfo);
        }