コード例 #1
0
        public static IVolume[] GetBelowVolumes(IBuilding building, IVolume volume)
        {
            List <IVolume> output = new List <IVolume>();

            IVolume[] volumeList  = building.AllPlans();
            int       volumeCount = volumeList.Length;

            for (int v = 0; v < volumeCount; v++)
            {
                IVolume other = volumeList[v];
                if (other == volume)
                {
                    continue;
                }

                if (other.ContainsPlanAbove(volume))
                {
                    output.Add(other);
                    output.AddRange(other.LinkPlanList());
                    break;
                }
            }
            output.Remove(volume);
            return(output.ToArray());
        }
コード例 #2
0
        public int VolumeBaseFloor(IVolume vol)
        {
            HUtils.log();

            int volumeCount = _volumes.Count;
            int output      = 0;

            //            Debug.Log("VolumeBaseFloor "+vol.name);
            for (int v = 0; v < volumeCount; v++)
            {
                IVolume other = _volumes[v];
                if (other == vol)
                {
                    continue;
                }
                if (other.ContainsPlanAbove(vol))
                {//start the loop again - register the floors below current plan - use parent plan to find other parents
                    v       = -1;
                    vol     = other;
                    output += vol.floors;
                    //                    Debug.Log("above plan "+ vol.name);
                }
            }
            //            Debug.Log("VolumeBaseFloor is " + output);
            return(output);
        }
コード例 #3
0
        public static bool HasParapet(IBuilding building, IVolume inVolume, int pointIndex)
        {
            if (inVolume[pointIndex].isGabled)
            {
                return(false);                              //gabled walls do not have a parapet
            }
//            if(inVolume.abovePlans.Count > 0) return false;//todo calculate this

            int        pointIndexB  = (pointIndex + 1) % inVolume.numberOfPoints;
            Vector2Int p0           = inVolume[pointIndex].position;
            Vector2Int p1           = inVolume[pointIndexB].position;
            float      volumeHeight = inVolume.planTotalHeight;

            int volumeCount = building.numberOfVolumes;

            for (int f = 0; f < volumeCount; f++)
            {
                IVolume otherVolume = building[f];

                if (volumeHeight > otherVolume.planTotalHeight)
                {
                    continue;                                           //other volume shorter - will not affect
                }
                if (otherVolume.ContainsPlanAbove(inVolume))
                {
                    continue;                                         //lower floorplans do not effect parapet
                }
                int pointCount = otherVolume.numberOfPoints;
                for (int p = 0; p < pointCount; p++)
                {
                    if (otherVolume == inVolume && p == pointIndex)//floorplan might join itself - ignore comparing facade to itself
                    {
                        continue;
                    }

                    Vector2Int pB0 = otherVolume[p].position;
                    if (pB0 != p0 && pB0 != p1)
                    {
                        continue;                        //points don't match
                    }
                    int        pB  = (p + 1) % otherVolume.numberOfPoints;
                    Vector2Int pB1 = otherVolume[pB].position;
                    if (pB1 != p0 && pB1 != p1)
                    {
                        continue;                        //points don't match
                    }
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
        public bool IsBaseVolume(IVolume input)
        {
            int volumeCount = numberOfVolumes;

            for (int v = 0; v < volumeCount; v++)
            {
                IVolume subject = this[v];
                if (subject == input)
                {
                    continue;
                }

                if (subject.ContainsPlanAbove(input))
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #5
0
        public int VolumeBaseFloor(IVolume vol)
        {
            int volumeCount = _volumes.Count;
            int output      = 0;

            for (int v = 0; v < volumeCount; v++)
            {
                IVolume other = _volumes[v];
                if (other == vol)
                {
                    continue;
                }
                if (other.ContainsPlanAbove(vol))
                {                //start the loop again - register the floors below current plan - use parent plan to find other parents
                    v       = -1;
                    vol     = other;
                    output += vol.floors;
                }
            }
            return(output);
        }