|
|
@@ -5,6 +5,7 @@
|
|
|
|
|
|
include_once('se-lib/DB_Dump.php');
|
|
|
include_once('se-lib/UsersHelper.php');
|
|
|
+Lib::Loadclass('Nodes_path_analys');
|
|
|
|
|
|
|
|
|
|
|
|
@@ -235,6 +236,9 @@ class GIS_OPT_STRUCTURES2 {
|
|
|
$this->tables->$src_table->obj_cursor[$obj]->x=$this->tables->$src_table->cursor->x;
|
|
|
$this->tables->$src_table->obj_cursor[$obj]->y=$this->tables->$src_table->cursor->y;
|
|
|
}
|
|
|
+ function get_obj_cursor_layer($src_table,$obj,$xy) {
|
|
|
+ return $this->tables->$src_table->obj_cursor[$obj]->$xy;
|
|
|
+ }
|
|
|
|
|
|
function set_obj_size_width($src_table,$obj,$width) {
|
|
|
$this->tables->$src_table->obj_width[$obj]=$width+20;
|
|
|
@@ -265,7 +269,7 @@ class GIS_OPT_STRUCTURES2 {
|
|
|
function set_obj_coords_by_parent($parent_table,$parent_obj,$src_table,$obj) {
|
|
|
echo "\n// set_obj_coords_by_parent (".$parent_table.",".$parent_obj.",".$src_table.",".$obj.") ";
|
|
|
$this->tables->$src_table->obj_cursor[$obj]->x=$this->tables->$parent_table->obj_cursor[$parent_obj]->x+10;
|
|
|
- $this->tables->$src_table->obj_cursor[$obj]->y=$this->tables->$parent_table->obj_cursor[$parent_obj]->y+10;
|
|
|
+ $this->tables->$src_table->obj_cursor[$obj]->y=$this->tables->$parent_table->obj_cursor[$parent_obj]->y+15;
|
|
|
echo " - i setted ".$this->tables->$parent_table->obj_cursor[$parent_obj]->x."/ ".$this->tables->$parent_table->obj_cursor[$parent_obj]->y;
|
|
|
}
|
|
|
|
|
|
@@ -281,13 +285,13 @@ class GIS_OPT_STRUCTURES2 {
|
|
|
echo " - ".$child_table;
|
|
|
$count+=count($child_table_arr)*20;
|
|
|
|
|
|
- if(strlen(self::get_obj_name($src_table,$obj)) > $width) $width=strlen(self::get_obj_name($src_table,$obj))*5;
|
|
|
+ if(strlen(self::get_obj_name($src_table,$obj)) > $width) $width=strlen(self::get_obj_name($src_table,$obj))*6; //TODO trzeba przesunac obiekt obok
|
|
|
}
|
|
|
$count_local=count($this->tables->$src_table->childs[$obj]->objects)*20;
|
|
|
|
|
|
if($width<100) $width=100;
|
|
|
if($count_local>$count) $count=$count_local;
|
|
|
- $count=$count+15+self::get_layer_deepth($src_table)*15;
|
|
|
+ $count=$count+15+self::get_layer_deepth($src_table)*20;
|
|
|
// $this->tables->$src_table->min_y_size[$obj]=$count;
|
|
|
|
|
|
self::set_obj_min_y_size($src_table,$obj,$count);
|
|
|
@@ -310,14 +314,33 @@ class GIS_OPT_STRUCTURES2 {
|
|
|
|
|
|
//funkcja do zwracania pierwszego obiektu wg roznych kryteriow : najmniej_powiazan, powiazanie z poprzednim, etc...
|
|
|
function get_next_obj($src_table,$situation) {
|
|
|
- echo "\n /* 313: Situation <-- ";
|
|
|
+ echo "\n /* 313: Situation <-- for ".$src_table;
|
|
|
print_r($situation);
|
|
|
print_r($this->get_next_obj);
|
|
|
echo "*/\n";
|
|
|
|
|
|
+ $ret=self::get_next_obj_by_path($src_table);
|
|
|
+ if(!empty($ret)) { $this->get_next_obj->last_obj=$ret; return $ret; }
|
|
|
+ //die('327 Skonczyla sie nowa sciezka uzyc/przeliczyc!');
|
|
|
+
|
|
|
+
|
|
|
+ echo "\n //322 Skonczyla sie sciezka, nowa przeliczamy";
|
|
|
+ self::analyze_arrange_paths($src_table,self::get_next_obj_unlayed($src_table));
|
|
|
+ self::make_offset_layer_coords_by_fit_new_path($src_table);
|
|
|
+
|
|
|
+ $ret=self::get_next_obj_by_path($src_table);
|
|
|
+ if(!empty($ret)) {
|
|
|
+ $this->get_next_obj->last_obj=$ret;
|
|
|
+ if(!empty($ret)) return $ret;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if($situation->count>1) {
|
|
|
if($situation->min_links==0) $ret=$situation->min_links_id;
|
|
|
else if($situation->min_links==1) { echo "\n// 320:Sytuacja min_links==1";
|
|
|
+ //bierzemy pod uwage rozmieszczenie sciezek - sprobujemy analizowac tylko te, ktore sa wyswietlone
|
|
|
+
|
|
|
if(isset($this->get_next_obj->last_obj)) {
|
|
|
if(isset($this->get_next_obj->last_obj_count)) {
|
|
|
|
|
|
@@ -343,12 +366,77 @@ class GIS_OPT_STRUCTURES2 {
|
|
|
|
|
|
|
|
|
if(!isset($ret)) $ret=$situation->id;
|
|
|
+
|
|
|
return $ret;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
+ function analyze_arrange_paths($src_table,$unlayed) {
|
|
|
+ //do szukania najdluzszej sciezki
|
|
|
+ echo "\n /* 370 f.analyze_arrange_paths unlayed";
|
|
|
+ print_r($unlayed);
|
|
|
+ echo "*/";
|
|
|
+ $w = new Nodes_path_analys;
|
|
|
+ $sciezki=$w->trasuj_wezly($this->tables->$src_table->links,$unlayed);
|
|
|
+ $najdluzsza=$w->najdluzsza_sciezka();
|
|
|
+ $this->tables->$src_table->Nodes_path_analys->paths=$sciezki;
|
|
|
+ $this->tables->$src_table->Nodes_path_analys->longest=$najdluzsza;
|
|
|
+ //print_r($sciezki);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ function make_offset_layer_coords_by_fit_new_path($src_table) {
|
|
|
+ //przyklad
|
|
|
+ //stara sceizka 41,23,24,31
|
|
|
+ //nowa sciezka 25,28,27,32,29,30
|
|
|
+ //wezel 25 ma powiazanie z 24, zatem sciezka nowa powinna wystartowac pod namalowanym wezlem 24
|
|
|
+ //offset_layer_coords(,,)
|
|
|
+ echo "\n /* 392: tables->".$src_table.">layed ";
|
|
|
+ print_r($this->tables->$src_table->layed);
|
|
|
+ //print_r($this->tables->$src_table->obj_cursor);
|
|
|
+
|
|
|
+ //szukam do ktorego moge sie przylozyc wezla na podstawie sciezki
|
|
|
+ $najdluzsza=$this->tables->$src_table->Nodes_path_analys->longest;
|
|
|
+ foreach($this->tables->$src_table->Nodes_path_analys->paths[$najdluzsza] as $wezel) {
|
|
|
+ // echo " 402: sprawdzam:".$wezel;
|
|
|
+ foreach($this->tables->$src_table->links->$wezel as $link=>$link_) {
|
|
|
+ // echo " sprawdzam:".$link;
|
|
|
+ if(isset($this->tables->$src_table->layed[$link])) {
|
|
|
+ echo "\n 403 znalazlem wezel do podl ".$link." TODO jest wiecej powiazan. Paper used=>y ".$this->paper_used->y; //TODO trzeba wiedziec jakie jest ulozenie max kursora etc...
|
|
|
+ $height=self::get_obj_size_by_child_recurs($src_table,$wezel);
|
|
|
+ echo "\n nowe dla(".$link.") xy:(".$this->tables->$src_table->layed[$link]->start_x."+100 y:".$this->tables->$src_table->layed[$link]->start_y."+".$this->tables->$src_table->layed[$link]->height." ";
|
|
|
+ $this->tables->$src_table->layed[$link]->start_y=+$height;
|
|
|
+ self::set_layer_coords($src_table,$this->tables->$src_table->layed[$link]->start_x+200+self::notify_lay_nextrow()*150,$this->paper_used->y+50);
|
|
|
+ //self::notify_layed_obj_xyh($src_table,$link,$this->tables->$src_table->layed[$link]->start_x+100,$this->tables->$src_table->layed[$link]->start_y+$this->tables->$src_table->layed[$link]->height+50);
|
|
|
+ print_r($this->tables->$src_table->layed);
|
|
|
+ echo "*/";
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ echo " 402:".$wezel;
|
|
|
+ }
|
|
|
+ echo "najdluzsza:".$najdluzsza." */";
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ function get_next_obj_by_path($src_table) {
|
|
|
+ //proba skorzystania z pierwszej sciezki
|
|
|
+ $longest=$this->tables->$src_table->Nodes_path_analys->longest;
|
|
|
+ foreach($this->tables->$src_table->Nodes_path_analys->paths[$longest] as $ret) {
|
|
|
+ foreach(self::get_next_obj_unlayed($src_table) as $obj) {
|
|
|
+ echo "\n //322: get_next_obj_unlayed testuje ".$obj." dla ".$src_table;
|
|
|
+ if($obj==$ret) {
|
|
|
+ echo "\n //327: zwracam ze sciezki ".$ret;
|
|
|
+ return $ret;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
function analyze_arrange_situation($src_table) {
|
|
|
@@ -409,7 +497,7 @@ class GIS_OPT_STRUCTURES2 {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
$ret->min_links=$min_links;
|
|
|
$ret->max_links=$max_links;
|
|
|
@@ -420,6 +508,7 @@ class GIS_OPT_STRUCTURES2 {
|
|
|
$ret->count=count($cnt);
|
|
|
$ret->id=$cnt[0];
|
|
|
|
|
|
+ echo "\n/* Analiza wezlow do rozmieszczenia" ; print_r($ret); echo "*/\n";
|
|
|
return $ret;
|
|
|
|
|
|
|
|
|
@@ -450,19 +539,21 @@ class GIS_OPT_STRUCTURES2 {
|
|
|
|
|
|
|
|
|
//echo "\nvar ".$src_table."_".$obj." = new joint.shapes.basic.Rect({
|
|
|
+ $height=self::get_obj_size_by_child_recurs($src_table,$obj);
|
|
|
+ $width=self::get_obj_size_width($src_table,$obj);
|
|
|
echo "\nvar ".$src_table."_".$obj." = new joint.shapes.devs.".self::get_type_table($src_table)."({
|
|
|
|
|
|
|
|
|
- position: { x: ".$this->tables->$src_table->obj_cursor[$obj]->x.", y: ".$this->tables->$src_table->obj_cursor[$obj]->y." },
|
|
|
- size: { width: ".self::get_obj_size_width($src_table,$obj).", height: ".self::get_obj_size_by_child_recurs($src_table,$obj)." }
|
|
|
+ position: { x: ".self::get_obj_cursor_layer($src_table,$obj,'x').", y: ".self::get_obj_cursor_layer($src_table,$obj,'y')." },
|
|
|
+ size: { width: ".$width.", height: ".$height." }
|
|
|
, attrs: {
|
|
|
- text: { text: '".self::get_obj_name($src_table,$obj).$obj."', fill: 'white' , 'y-alignment': 'top', 'x-alignment': 'left' } ,
|
|
|
+ text: { text: '".self::get_obj_name($src_table,$obj).$obj."', fill: 'black' , 'y-alignment': 'top', 'x-alignment': 'left' } ,
|
|
|
'inPorts circle': { fill: 'PaleGreen' }
|
|
|
} , label: { text: 'Dupa' }
|
|
|
|
|
|
".self::get_ports_for_obj($src_table,$obj)."
|
|
|
});\n";
|
|
|
- self::notify_layed_object($src_table,$obj);
|
|
|
+ self::notify_layed_object($src_table,$obj,self::get_obj_cursor_layer($src_table,$obj,'x'),self::get_obj_cursor_layer($src_table,$obj,'y'),$height,$width);
|
|
|
self::lay_object_child($src_table,$obj);
|
|
|
}
|
|
|
|
|
|
@@ -470,8 +561,25 @@ class GIS_OPT_STRUCTURES2 {
|
|
|
return in_array($src_table."_".$obj, $this->cells);
|
|
|
}
|
|
|
|
|
|
- function notify_layed_object($src_table,$obj) {
|
|
|
+ function notify_layed_object($src_table,$obj,$start_x,$start_y,$height,$width) {
|
|
|
$this->cells[]=$src_table."_".$obj;
|
|
|
+ if(isset($this->paper_used)) {
|
|
|
+ if($this->paper_used->y<$start_y+$height) $this->paper_used->y=$start_y+$height;
|
|
|
+ } else $this->paper_used->y=$start_y+$height;
|
|
|
+ self::notify_layed_obj_xyh($src_table,$obj,$start_x,$start_y,$height);
|
|
|
+ }
|
|
|
+
|
|
|
+ function notify_lay_nextrow() {
|
|
|
+ if(isset($this->paper_used->rows)) $this->paper_used->rows++;
|
|
|
+ else $this->paper_used->rows=1;
|
|
|
+ return $this->paper_used->rows;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ function notify_layed_obj_xyh($src_table,$obj,$start_x,$start_y,$height=null) {
|
|
|
+ $this->tables->$src_table->layed[$obj]->start_x=$start_x;
|
|
|
+ $this->tables->$src_table->layed[$obj]->start_y=$start_y;
|
|
|
+ if(isset($height)) $this->tables->$src_table->layed[$obj]->height=$height;
|
|
|
}
|
|
|
|
|
|
function lay_object_child($src_table,$obj) {
|
|
|
@@ -482,7 +590,7 @@ class GIS_OPT_STRUCTURES2 {
|
|
|
self::calculate_obj_size_by_child_recurs($child_table,$child_id);
|
|
|
self::set_obj_coords_by_parent($src_table,$obj,$child_table,$child_id);
|
|
|
self::set_obj_size_width_by_parent($src_table,$obj,$child_table,$child_id,array('ratio'=>0.3) );
|
|
|
- self::lay_object($child_table,$child_id,$this->tables->$src_table->obj_cursor[$obj]->x,$this->tables->$src_table->obj_cursor[$obj]->y);
|
|
|
+ self::lay_object($child_table,$child_id);
|
|
|
} else if($this->tables->$child_table->set_type_table=='Ports') {
|
|
|
// echo "\n //282 Trafilem na Ports";
|
|
|
}
|
|
|
@@ -576,6 +684,9 @@ class GIS_OPT_STRUCTURES2 {
|
|
|
DEBUG_S(-3,'DEBUG_ports_obj',$this->ports_obj,__FILE__,__FUNCTION__,__LINE__);
|
|
|
DEBUG_S(-3,'DEBUG_ports_tables',$this->ports_tables,__FILE__,__FUNCTION__,__LINE__);
|
|
|
DEBUG_S(-3,'ports_to_add_connect_link',$this->ports_to_add_connect_link,__FILE__,__FUNCTION__,__LINE__);
|
|
|
+ DEBUG_S(-3,'opt_przelacznice_mufy->links',$this->tables->opt_przelacznice_mufy->links,__FILE__,__FUNCTION__,__LINE__);
|
|
|
+ DEBUG_S(-3,'opt_lokalizacje->links',$this->tables->opt_lokalizacje->links,__FILE__,__FUNCTION__,__LINE__);
|
|
|
+ DEBUG_S(-3,'opt_przelacznice_mufy->Nodes_path_analys',$this->tables->opt_przelacznice_mufy->Nodes_path_analys,__FILE__,__FUNCTION__,__LINE__);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -627,8 +738,6 @@ var connect = function(source, sourcePort, target, targetPort) {
|
|
|
// self::get_next_obj($src_table,null,array('less_connections'));
|
|
|
$situation=self::analyze_arrange_situation($src_table);
|
|
|
|
|
|
- // print_r($situation);
|
|
|
-
|
|
|
while($obj=self::get_next_obj($src_table,$situation)) {
|
|
|
|
|
|
echo "\n//631:: wzialem ID ".$obj;
|
|
|
@@ -645,7 +754,7 @@ var connect = function(source, sourcePort, target, targetPort) {
|
|
|
|
|
|
self::lay_object($src_table,$obj);
|
|
|
echo "\n //606: robie offset o ".self::get_obj_size_width($src_table,$obj)." dla obj ".$obj." bo x:".$this->tables->$src_table->obj_cursor[$obj]->x ." a width:".self::get_obj_size_width($src_table,$obj);
|
|
|
- self::offset_layer_coords($src_table,self::get_obj_size_width($src_table,$obj)+100,0);
|
|
|
+ self::offset_layer_coords($src_table,self::get_obj_size_width($src_table,$obj)+150,0);
|
|
|
$situation=self::analyze_arrange_situation($src_table);
|
|
|
|
|
|
}
|
|
|
@@ -727,7 +836,7 @@ function GIS_OPT_STRUCTURES2() {
|
|
|
|
|
|
|
|
|
//$wezly=$cp->get_opt_objects('opt_przelacznice_mufy','id_0','Nazwa','id_wezel','Rozdzielcza_wezly','id_opt_lokalizacja','opt_lokalizacje',"where \"Nazwa\" like '%test%'");
|
|
|
- $wezly=$cp->get_opt_objects('opt_przelacznice_mufy','id_0','Nazwa','id_wezel','Rozdzielcza_wezly','id_opt_lokalizacja','opt_lokalizacje',"where \"id_0\" in(23,24,32,31,25,28,27) ");
|
|
|
+ $wezly=$cp->get_opt_objects('opt_przelacznice_mufy','id_0','Nazwa','id_wezel','Rozdzielcza_wezly','id_opt_lokalizacja','opt_lokalizacje',"where \"id_0\" in(23,24,32,31,25,28,27,41) ");
|
|
|
|
|
|
|
|
|
$cp->set_type_table('opt_przelacznice_mufy','Coupled');
|
|
|
@@ -744,10 +853,10 @@ function GIS_OPT_STRUCTURES2() {
|
|
|
$wlokna2=$cp->get_opt_objects('opt_wlokna','id',null,null,null,'id_spaw_b','opt_spawy');
|
|
|
|
|
|
|
|
|
- $spawy_b=$cp->get_opt_objects_parent('opt_spawy','id_0',null,null,null,'id_tacka','opt_tacki','1=1','opt_wlokna','id_spaw_b','id'); //chce znalezc te sprawy ktore sa w wloknach jako B
|
|
|
- $spawy_b2=$cp->get_opt_objects_parent('opt_spawy','id_0',null,null,null,'id_tacka','opt_tacki','1=1','opt_wlokna','id_spaw_a','id'); //chce znalezc te sprawy ktore sa w wloknach jako B
|
|
|
+ $spawy_b=$cp->get_opt_objects_parent('opt_spawy','id_0',null,null,null,'id_tacka','opt_tacki','1=1','opt_wlokna','id_spaw_b','id'); //try to find splices which are in fibres as B
|
|
|
+ $spawy_b2=$cp->get_opt_objects_parent('opt_spawy','id_0',null,null,null,'id_tacka','opt_tacki','1=1','opt_wlokna','id_spaw_a','id'); //try to find splices which are in fibres as A
|
|
|
|
|
|
- $tacki_b=$cp->get_opt_objects_parent('opt_tacki','id_0',null,null,null,'id_przelac','opt_przelacznice_mufy','1=1','opt_spawy','id_tacka','id_0'); //chce znalezc te sprawy ktore sa w wloknach jako B
|
|
|
+ $tacki_b=$cp->get_opt_objects_parent('opt_tacki','id_0',null,null,null,'id_przelac','opt_przelacznice_mufy','1=1','opt_spawy','id_tacka','id_0'); //try to find splices which are in fibres as B
|
|
|
$wezly_b=$cp->get_opt_objects_parent('opt_przelacznice_mufy','id_0','Nazwa','id_wezel','Rozdzielcza_wezly','id_opt_lokalizacja','opt_lokalizacje','1=1','opt_tacki','id_przelac','id_0');
|
|
|
|
|
|
// $cp->layer_arrange(1,array('opt_przelacznice_mufy'));
|
|
|
@@ -768,7 +877,11 @@ function GIS_OPT_STRUCTURES2() {
|
|
|
*/
|
|
|
|
|
|
|
|
|
- $cp->find_connect_paths('opt_przelacznice_mufy');
|
|
|
+ $cp->find_connect_paths('opt_lokalizacje');
|
|
|
+ echo "<pre>";
|
|
|
+ $cp->analyze_arrange_paths('opt_przelacznice_mufy'); //analizuje jakie sa sciezki glowne i ustalam dla nich rozmieszczenie
|
|
|
+ echo "</pre>";
|
|
|
+// $cp->find_connect_paths('opt_przelacznice_mufy');
|
|
|
$cp->invert_layer_deepth();
|
|
|
|
|
|
// $cp->arrange_objects_layer('opt_przelacznice_mufy');
|
|
|
@@ -779,7 +892,7 @@ function GIS_OPT_STRUCTURES2() {
|
|
|
|
|
|
$cp->to_html('opt_przelacznice_mufy');
|
|
|
|
|
|
-
|
|
|
+ $cp->DEBUG('opt_lokalizacje');
|
|
|
$cp->DEBUG('opt_przelacznice_mufy'); $cp->DEBUG('opt_spawy');
|
|
|
$cp->DEBUG('opt_tacki');
|
|
|
$cp->DEBUG('opt_spawy');
|