|
@@ -7,12 +7,16 @@ from operator import itemgetter
|
|
import numpy as np
|
|
import numpy as np
|
|
import vg
|
|
import vg
|
|
|
|
|
|
-from utils import BinaryRelationItem, BinaryRelationCollection
|
|
|
|
|
|
+from .utils import BinaryRelationItem, BinaryRelationCollection
|
|
|
|
|
|
np.seterr(divide='ignore', invalid='ignore')
|
|
np.seterr(divide='ignore', invalid='ignore')
|
|
|
|
|
|
|
|
|
|
def calc_adjacent_relation(columns, segments, v_walls, walls):
|
|
def calc_adjacent_relation(columns, segments, v_walls, walls):
|
|
|
|
+ columns = list(map(load_location, columns))
|
|
|
|
+ segments = list(map(load_curve, segments))
|
|
|
|
+ v_walls = list(map(load_location, v_walls))
|
|
|
|
+ walls = list(map(load_location, walls))
|
|
columns_dic = list_to_dict(columns)
|
|
columns_dic = list_to_dict(columns)
|
|
v_walls_dic = list_to_dict(v_walls)
|
|
v_walls_dic = list_to_dict(v_walls)
|
|
walls_dic = list_to_dict(walls)
|
|
walls_dic = list_to_dict(walls)
|
|
@@ -36,7 +40,11 @@ def calc_adjacent_relation(columns, segments, v_walls, walls):
|
|
binary_space_relations = BinaryRelationItem(space1, space2)
|
|
binary_space_relations = BinaryRelationItem(space1, space2)
|
|
space_relation.update(binary_space_relations)
|
|
space_relation.update(binary_space_relations)
|
|
|
|
|
|
- return space_relation
|
|
|
|
|
|
+ relations = []
|
|
|
|
+ for relation in relations:
|
|
|
|
+ relations.append(relation)
|
|
|
|
+
|
|
|
|
+ return relations
|
|
|
|
|
|
|
|
|
|
def group_segments(segments, units):
|
|
def group_segments(segments, units):
|
|
@@ -123,3 +131,13 @@ def are_adjacent(segment1, segment2, units):
|
|
return projection1_max > projection2_min and projection2_max > projection1_min
|
|
return projection1_max > projection2_min and projection2_max > projection1_min
|
|
|
|
|
|
return False
|
|
return False
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def load_location(x):
|
|
|
|
+ x['location'] = json.loads(x['location'])
|
|
|
|
+ return x
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def load_curve(x):
|
|
|
|
+ x['curve'] = json.loads(x['curve'])
|
|
|
|
+ return x
|