Figure constraintFigure = mFigure.get(c.getID());
GroupConstraint gcDest = cme.addGroupConstraint();
gce.setType(gcDest , gct);
GroupConstraintFigure gcf = new GroupConstraintFigure();
gcf.setAttribute("id" , gcDest.getID());
if (GroupConstraintType.SingleGroup.equals(gct)) {
gcf.setAttribute("GroupType" , GroupConstraintFigure.Single);
} else if (GroupConstraintType.MultiGroup.equals(gct)) {
gcf.setAttribute("GroupType" , GroupConstraintFigure.Multi);
} else {
gcf.setAttribute("GroupType" , GroupConstraintFigure.All);
}
// gcfDest.setAttribute("PortPosition" , gcfSrc.getAttribute("PortPosition"));
gcf.setAttribute("bounds" , constraintFigure.getAttribute("bounds"));
gcf.setAttribute("frameColor" , constraintFigure.getAttribute("frameColor"));
dv.add(gcf);
gcf.setDisplayBox(constraintFigure.getDisplayBox());
for (Iterator<Feature> itFeature=features.iterator() ; itFeature.hasNext() ; ) {
Feature f = itFeature.next();
gce.addFeature(gcDest , f);
CFRelation cfrSrc = cm.getCFRelation(f , c , true);
if (cfrSrc==null) {
cfrSrc = cm.getCFRelation(f , c , false);
}
CFRModifier modifier = cfrSrc.getModifier();
if (revertCFRelation) {
if (modifier.equals(CFRModifier.Affirmation)) {
modifier = CFRModifier.Negation;
} else {
modifier = CFRModifier.Affirmation;
}
}
CFRelation cfrDest = cme.addCFRelation(f , gcDest , false , modifier);
PLConnection plcOld = (PLConnection)mFigure.get(cfrSrc.getID());
PLConnection plcNew = new PLConnection();
plcNew.setAttribute("id" , cfrDest.getID());
plcNew.setAttribute("frameColor" , plcOld.getAttribute("frameColor"));
plcNew.setAttribute("type" , plcOld.getAttribute("type"));
plcNew.setAttribute("CFRModifier" , modifier.getName());
for (int i=0 ; i<plcOld.pointCount() ; i++) {
plcNew.addPoint(plcOld.pointAt(i).x , plcOld.pointAt(i).y);
}
plcNew.startPoint(gcf.getConnectors()[0].getDisplayBox().x , gcf.getConnectors()[0].getDisplayBox().y);
plcNew.connectStart(gcf.getConnectors()[0]);
Figure featureFigure = mFigure.get(f.getID());
plcNew.endPoint(featureFigure.getConnectors()[3].getDisplayBox().x , featureFigure.getConnectors()[3].getDisplayBox().y);
plcNew.connectEnd(featureFigure.getConnectors()[3]);
dv.add(plcNew);