mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-22 19:33:48 +01:00
Adding start and end arrows to relationship lines
This commit is contained in:
parent
4777ccf6fb
commit
8ddb66eebb
@ -652,7 +652,8 @@ mindplot.MindmapDesigner.prototype._buildRelationship = function (model) {
|
||||
|
||||
|
||||
relationLine.getLine().setDashed(3,2);
|
||||
relationLine.getLine().setShowArrow(model.getEndArrow());
|
||||
relationLine.getLine().setShowEndArrow(model.getEndArrow());
|
||||
relationLine.getLine().setShowStartArrow(model.getStartArrow());
|
||||
relationLine.setModel(model);
|
||||
|
||||
//Add Listeners
|
||||
|
@ -10,6 +10,7 @@ mindplot.RelationshipModel = function(fromNode, toNode)
|
||||
this._srcCtrlPoint=null;
|
||||
this._destCtrlPoint=null;
|
||||
this._endArrow=true;
|
||||
this._startArrow=false;
|
||||
this._ctrlPointRelative=false;
|
||||
|
||||
};
|
||||
@ -58,6 +59,14 @@ mindplot.RelationshipModel.prototype.setEndArrow= function(endArrow){
|
||||
this._endArrow = endArrow;
|
||||
};
|
||||
|
||||
mindplot.RelationshipModel.prototype.getStartArrow= function(){
|
||||
return this._startArrow;
|
||||
};
|
||||
|
||||
mindplot.RelationshipModel.prototype.setStartArrow= function(startArrow){
|
||||
this._startArrow = startArrow;
|
||||
};
|
||||
|
||||
mindplot.RelationshipModel.prototype.clone = function(model){
|
||||
var result = new mindplot.RelationshipModel(this._fromNode, this._toNode);
|
||||
result._id = this._id;
|
||||
@ -65,6 +74,7 @@ mindplot.RelationshipModel.prototype.clone = function(model){
|
||||
result._srcCtrlPoint = this._srcCtrlPoint;
|
||||
result._destCtrlPoint = this._destCtrlPoint;
|
||||
result._endArrow = this._endArrow;
|
||||
result._startArrow = this._startArrow;
|
||||
return result;
|
||||
};
|
||||
|
||||
|
@ -216,6 +216,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._relationshipToXML = function(docum
|
||||
}
|
||||
}
|
||||
relationDom.setAttribute("endArrow",relationship.getEndArrow());
|
||||
relationDom.setAttribute("startArrow",relationship.getStartArrow());
|
||||
return relationDom;
|
||||
};
|
||||
|
||||
@ -382,6 +383,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeRelationship = function
|
||||
var srcCtrlPoint = domElement.getAttribute("srcCtrlPoint");
|
||||
var destCtrlPoint = domElement.getAttribute("destCtrlPoint");
|
||||
var endArrow = domElement.getAttribute("endArrow");
|
||||
var startArrow = domElement.getAttribute("startArrow");
|
||||
var model = mindmap.createRelationship(srcId, destId);
|
||||
model.setLineType(lineType);
|
||||
if(core.Utils.isDefined(srcCtrlPoint) && srcCtrlPoint!=""){
|
||||
@ -390,7 +392,8 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeRelationship = function
|
||||
if(core.Utils.isDefined(destCtrlPoint) && destCtrlPoint!=""){
|
||||
model.setDestCtrlPoint(core.Point.fromString(destCtrlPoint));
|
||||
}
|
||||
model.setEndArrow(endArrow);
|
||||
model.setEndArrow(endArrow=="true");
|
||||
model.setStartArrow(startArrow=="true");
|
||||
return model;
|
||||
};
|
||||
|
||||
|
@ -54,12 +54,20 @@ web2d.CurvedLine.prototype.getTo = function()
|
||||
return this._peer.getTo();
|
||||
};
|
||||
|
||||
web2d.CurvedLine.prototype.setShowArrow = function(visible){
|
||||
this._peer.setShowArrow(visible);
|
||||
web2d.CurvedLine.prototype.setShowEndArrow = function(visible){
|
||||
this._peer.setShowEndArrow(visible);
|
||||
};
|
||||
|
||||
web2d.CurvedLine.prototype.isShowArrow = function(){
|
||||
return this._peer.isShowArrow();
|
||||
web2d.CurvedLine.prototype.isShowEndArrow = function(){
|
||||
return this._peer.isShowEndArrow();
|
||||
};
|
||||
|
||||
web2d.CurvedLine.prototype.setShowStartArrow = function(visible){
|
||||
this._peer.setShowStartArrow(visible);
|
||||
};
|
||||
|
||||
web2d.CurvedLine.prototype.isShowStartArrow = function(){
|
||||
return this._peer.isShowStartArrow();
|
||||
};
|
||||
|
||||
web2d.CurvedLine.prototype.setSrcControlPoint = function(control){
|
||||
|
@ -132,13 +132,22 @@ web2d.peer.svg.CurvedLinePeer.prototype.getLineStyle = function (){
|
||||
};
|
||||
|
||||
|
||||
web2d.peer.svg.CurvedLinePeer.prototype.setShowArrow = function(visible){
|
||||
this._showArrow =visible;
|
||||
web2d.peer.svg.CurvedLinePeer.prototype.setShowEndArrow = function(visible){
|
||||
this._showEndArrow =visible;
|
||||
this.updateLine();
|
||||
};
|
||||
|
||||
web2d.peer.svg.CurvedLinePeer.prototype.isShowArrow = function(){
|
||||
return this._showArrow;
|
||||
web2d.peer.svg.CurvedLinePeer.prototype.isShowEndArrow = function(){
|
||||
return this._showEndArrow;
|
||||
};
|
||||
|
||||
web2d.peer.svg.CurvedLinePeer.prototype.setShowStartArrow = function(visible){
|
||||
this._showStartArrow =visible;
|
||||
this.updateLine();
|
||||
};
|
||||
|
||||
web2d.peer.svg.CurvedLinePeer.prototype.isShowStartArrow = function(){
|
||||
return this._showStartArrow;
|
||||
};
|
||||
|
||||
|
||||
@ -146,7 +155,7 @@ web2d.peer.svg.CurvedLinePeer.prototype._updatePath = function(avoidControlPoint
|
||||
{
|
||||
this._calculateAutoControlPoints(avoidControlPointFix);
|
||||
var x,y, xp, yp;
|
||||
if(this._showArrow){
|
||||
if(this._showEndArrow){
|
||||
if(this._control2.y == 0)
|
||||
this._control2.y=1;
|
||||
var y0 = this._control2.y;
|
||||
@ -166,8 +175,36 @@ web2d.peer.svg.CurvedLinePeer.prototype._updatePath = function(avoidControlPoint
|
||||
xp *=Math.sign(x3);
|
||||
yp = (x3==0?l*Math.sign(y3):mp*xp);
|
||||
}
|
||||
var path = "M"+this._x1+","+this._y1
|
||||
+" C"+(this._control1.x+this._x1)+","+(this._control1.y+this._y1)+" "
|
||||
var xs2,ys2, xp2, yp2;
|
||||
if(this._showStartArrow){
|
||||
if(this._control1.y == 0)
|
||||
this._control1.y=1;
|
||||
var y02 = this._control1.y;
|
||||
var x02 = this._control1.x;
|
||||
var x22=x02+y02;
|
||||
var y22 = y02-x02;
|
||||
var x32 = x02-y02;
|
||||
var y32 = y02+x02;
|
||||
var m2 = y22/x22;
|
||||
var mp2 = y32/x32;
|
||||
var l2 = 6;
|
||||
var pow2 = Math.pow;
|
||||
xs2 = (x22==0?0:Math.sqrt(pow2(l2,2)/(1+pow2(m2,2))));
|
||||
xs2 *=Math.sign(x22);
|
||||
ys2 = (x22==0?l2*Math.sign(y22):m2*xs2);
|
||||
xp2 = (x32==0?0:Math.sqrt(pow2(l2,2)/(1+pow2(mp2,2))));
|
||||
xp2 *=Math.sign(x32);
|
||||
yp2 = (x32==0?l2*Math.sign(y32):mp2*xp2);
|
||||
}
|
||||
|
||||
var path = (this._showStartArrow?" "
|
||||
+"M"+this._x1+","+this._y1+" "
|
||||
+"L"+(xs2+this._x1)+","+(ys2+this._y1)
|
||||
+"M"+this._x1+","+this._y1+" "
|
||||
+"L"+(xp2+this._x1)+","+(yp2+this._y1)
|
||||
:"")+
|
||||
"M"+this._x1+","+this._y1
|
||||
+" C"+(this._control1.x+this._x1)+","+(this._control1.y+this._y1)+" "
|
||||
+(this._control2.x+this._x2)+","+(this._control2.y+this._y2)+" "
|
||||
+this._x2+","+this._y2+
|
||||
(this._lineStyle?" "
|
||||
@ -176,7 +213,7 @@ web2d.peer.svg.CurvedLinePeer.prototype._updatePath = function(avoidControlPoint
|
||||
+this._x1+","+(this._y1+3)+" Z"
|
||||
:""
|
||||
)+
|
||||
(this._showArrow?" "
|
||||
(this._showEndArrow?" "
|
||||
+"M"+this._x2+","+this._y2+" "
|
||||
+"L"+(x+this._x2)+","+(y+this._y2)
|
||||
+"M"+this._x2+","+this._y2+" "
|
||||
|
@ -99,6 +99,8 @@ public class FreemindExporter
|
||||
arrowlink.setDESTINATION(dstNode.getID());
|
||||
if(relationship.isEndArrow())
|
||||
arrowlink.setENDARROW("Default");
|
||||
if(relationship.isStartArrow())
|
||||
arrowlink.setSTARTARROW("Default");
|
||||
List<Object> cloudOrEdge = srcNode.getArrowlinkOrCloudOrEdge();
|
||||
cloudOrEdge.add(arrowlink);
|
||||
}
|
||||
|
@ -323,7 +323,8 @@ public class FreemindImporter
|
||||
inclination = arrow.getSTARTINCLINATION().split(";");
|
||||
relationship.setSrcCtrlPoint(inclination[0]+","+inclination[1]);
|
||||
//relationship.setCtrlPointRelative(true);
|
||||
relationship.setEndArrow(!arrow.getENDARROW().equals("None"));
|
||||
relationship.setEndArrow(!arrow.getENDARROW().toLowerCase().equals("none"));
|
||||
relationship.setStartArrow(!arrow.getSTARTARROW().toLowerCase().equals("none"));
|
||||
relationship.setLineType("3");
|
||||
relationships.add(relationship);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@
|
||||
<xsd:attribute name="srcCtrlPoint" type="xsd:string"/>
|
||||
<xsd:attribute name="destCtrlPoint" type="xsd:string"/>
|
||||
<xsd:attribute name="endArrow" type="xsd:boolean"/>
|
||||
<xsd:attribute name="ctrlPointRelative" type="xsd:boolean"/>
|
||||
<xsd:attribute name="startArrow" type="xsd:boolean"/>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:schema>
|
@ -2,7 +2,7 @@
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2011.01.11 at 06:58:42 PM ART
|
||||
// Generated on: 2011.01.16 at 11:06:29 AM ART
|
||||
//
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2011.01.11 at 06:58:42 PM ART
|
||||
// Generated on: 2011.01.16 at 11:06:29 AM ART
|
||||
//
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2011.01.11 at 06:58:42 PM ART
|
||||
// Generated on: 2011.01.16 at 11:06:29 AM ART
|
||||
//
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2011.01.11 at 06:58:42 PM ART
|
||||
// Generated on: 2011.01.16 at 11:06:29 AM ART
|
||||
//
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2011.01.11 at 06:58:42 PM ART
|
||||
// Generated on: 2011.01.16 at 11:06:29 AM ART
|
||||
//
|
||||
|
||||
|
||||
@ -50,19 +50,11 @@ public class ObjectFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Map }
|
||||
* Create an instance of {@link Icon }
|
||||
*
|
||||
*/
|
||||
public Map createMap() {
|
||||
return new Map();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Link }
|
||||
*
|
||||
*/
|
||||
public Link createLink() {
|
||||
return new Link();
|
||||
public Icon createIcon() {
|
||||
return new Icon();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,6 +65,14 @@ public class ObjectFactory {
|
||||
return new TopicType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Map }
|
||||
*
|
||||
*/
|
||||
public Map createMap() {
|
||||
return new Map();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link RelationshipType }
|
||||
*
|
||||
@ -82,11 +82,11 @@ public class ObjectFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link Icon }
|
||||
* Create an instance of {@link Link }
|
||||
*
|
||||
*/
|
||||
public Icon createIcon() {
|
||||
return new Icon();
|
||||
public Link createLink() {
|
||||
return new Link();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,7 @@
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2011.01.11 at 06:58:42 PM ART
|
||||
// Generated on: 2011.01.16 at 11:06:29 AM ART
|
||||
//
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ import javax.xml.bind.annotation.XmlType;
|
||||
* <attribute name="srcCtrlPoint" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="destCtrlPoint" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="endArrow" type="{http://www.w3.org/2001/XMLSchema}boolean" />
|
||||
* <attribute name="ctrlPointRelative" type="{http://www.w3.org/2001/XMLSchema}boolean" />
|
||||
* <attribute name="startArrow" type="{http://www.w3.org/2001/XMLSchema}boolean" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
@ -57,7 +57,7 @@ public class RelationshipType {
|
||||
@XmlAttribute
|
||||
protected Boolean endArrow;
|
||||
@XmlAttribute
|
||||
protected Boolean ctrlPointRelative;
|
||||
protected Boolean startArrow;
|
||||
|
||||
/**
|
||||
* Gets the value of the id property.
|
||||
@ -228,27 +228,27 @@ public class RelationshipType {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the ctrlPointRelative property.
|
||||
* Gets the value of the startArrow property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isCtrlPointRelative() {
|
||||
return ctrlPointRelative;
|
||||
public Boolean isStartArrow() {
|
||||
return startArrow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the ctrlPointRelative property.
|
||||
* Sets the value of the startArrow property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setCtrlPointRelative(Boolean value) {
|
||||
this.ctrlPointRelative = value;
|
||||
public void setStartArrow(Boolean value) {
|
||||
this.startArrow = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2011.01.11 at 06:58:42 PM ART
|
||||
// Generated on: 2011.01.16 at 11:06:29 AM ART
|
||||
//
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user