Adding model update, model migrator, curved line support, relationship lines, remove of web-services classes

This commit is contained in:
Pablo Luna
2010-12-13 11:07:20 -03:00
parent 28aba40f6f
commit 67c4968aca
46 changed files with 2074 additions and 718 deletions

View File

@@ -1,22 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
core.Point = function(x, y)
{
this.x = x;
@@ -37,4 +37,9 @@ core.Point.prototype.inspect = function()
core.Point.prototype.clone = function()
{
return new core.Point(this.x, this.y);
};
};
core.Point.fromString = function(point) {
var values = point.split(',');
return new core.Point(values[0], values[1]);
};

View File

@@ -64,7 +64,8 @@ core.assert = function(assert, message)
{
stack = e;
}
core.Logger.logError(message + "," + stack);
wLogger.error(message + "," + stack);
// core.Logger.logError(message + "," + stack);
}
};
@@ -220,3 +221,54 @@ core.Utils.createDocumentFromText = function(/*string*/str, /*string?*/mimetype)
}
return null;
};
core.Utils.calculateRelationShipPointCoordinates = function(topic,controlPoint){
var size = topic.getSize();
var position = topic.getPosition();
var m = (position.y-controlPoint.y)/(position.x-controlPoint.x);
var y,x;
var gap = 5;
if(controlPoint.y>position.y+(size.height/2)){
y = position.y+(size.height/2)+gap;
x = position.x-((position.y-y)/m);
if(x>position.x+(size.width/2)){
x=position.x+(size.width/2);
}else if(x<position.x-(size.width/2)){
x=position.x-(size.width/2);
}
}else if(controlPoint.y<position.y-(size.height/2)){
y = position.y-(size.height/2) - gap;
x = position.x-((position.y-y)/m);
if(x>position.x+(size.width/2)){
x=position.x+(size.width/2);
}else if(x<position.x-(size.width/2)){
x=position.x-(size.width/2);
}
}else if(controlPoint.x<(position.x-size.width/2)){
x = position.x-(size.width/2) -gap;
y = position.y-(m*(position.x-x));
}else{
x = position.x+(size.width/2) + gap;
y = position.y-(m*(position.x-x));
}
return new core.Point(x,y);
};
core.Utils.calculateDefaultControlPoints = function(srcPos, tarPos){
var y = srcPos.y-tarPos.y;
var x = srcPos.x-tarPos.x;
var m = y/x;
var l = Math.sqrt(y*y+x*x)/3;
var fix=1;
if(srcPos.x>tarPos.x){
fix=-1;
}
var x1 = srcPos.x + Math.sqrt(l*l/(1+(m*m)))*fix;
var y1 = m*(x1-srcPos.x)+srcPos.y;
var x2 = tarPos.x + Math.sqrt(l*l/(1+(m*m)))*fix*-1;
var y2= m*(x2-tarPos.x)+tarPos.y;
return [new core.Point(x1,y1),new core.Point(x2,y2)];
};