Exemplo n.º 1
0
        internal void removeComponent(MasterGeoObj geoComp)
        {
            Debug.Log(geoComp.figName + " is being removed from the graph. Refer to trace for reason.");

            if (blockDelete == false)
            {
                if (geoComp.GetComponent <AnchorableBehaviour>() != null)
                {
                    geoComp.GetComponent <AnchorableBehaviour>().Detach();
                }


                if (geoComp.GetComponent <straightEdgeBehave>() != null || geoComp.GetComponent <flatfaceBehave>() != null)
                {
                    Node <string> meNode = geoComp.FindGraphNode();
                    if (rManList.Contains(meNode))
                    {
                        rManList.Remove(meNode);
                    }
                    geomanager.Remove(meNode.Value);
                    Destroy(geoComp.gameObject);
                }
                else
                {
                    string        meNAME = geoComp.figName;
                    Node <string> meNode = geomanager.findGraphNode(meNAME);
                    if (rManList.Contains(meNode))
                    {
                        rManList.Remove(meNode);
                    }
                    geomanager.Remove(meNAME);
                    Destroy(geoComp.gameObject);
                }
            }
        }
Exemplo n.º 2
0
        internal void checkLifeRequirements(MasterGeoObj geoComp)
        {
            //add case for clones.

            bool killorder = false;

            NodeList <string> neighborList = geoComp.FindGraphNode().Neighbors;

            GeoObjType type = geoComp.figType;

            int pointCount = 0;

            switch (type)
            {
            case GeoObjType.point:
                //degree == 0
                killorder = false;
                break;

            case GeoObjType.line:
                pointCount = neighborTypeCount(neighborList, GeoObjType.point);
                //Debug.Log(geoComp.gameObject.name+" has "+pointCount+" points.");
                if (pointCount < 2)
                {
                    killorder = true;
                }
                else
                {
                    killorder = false;
                }
                break;

            case GeoObjType.polygon:
                pointCount = neighborTypeCount(neighborList, GeoObjType.point);
                //TOFIX:  add cycle check
                if (pointCount < 3)
                {
                    killorder = true;
                }
                else
                {
                    killorder = false;
                }
                break;

            case GeoObjType.circle:
                pointCount = neighborTypeCount(neighborList, GeoObjType.point);
                if (pointCount < 1)     //|| geoComp.GetComponent<DependentCircle>().Radius <= 0.00000000001f)
                {
                    killorder = true;
                }
                else
                {
                    killorder = false;
                }
                break;

            case GeoObjType.revolvedsurface:
                //pointCount = neighborTypeCount (neighborList, "Point");
                //arcCount = neighborTypeCount (neighborList, "Arc");
                pointCount = neighborTypeCount(neighborList, GeoObjType.point);
                if (pointCount < 2)
                {
                    killorder = true;
                }
                else
                {
                    killorder = false;
                }
                break;

            case GeoObjType.sphere:
                pointCount = neighborTypeCount(neighborList, GeoObjType.point);
                if (pointCount < 2 || geoComp.GetComponent <DependentSphere>().radius <= 0.00000001f)
                {
                    killorder = true;
                }
                else
                {
                    killorder = false;
                }
                break;

            default:
                break;
            }

            if (killorder)
            {
                removeComponent(geoComp);
            }
        }