Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Implement Rotate method for Pictogram Element(Implement Rotate method for Pictogram Element )
Implement Rotate method for Pictogram Element [message #771139] Mon, 26 December 2011 12:38 Go to next message
Vinod Kannur is currently offline Vinod KannurFriend
Messages: 7
Registered: October 2011
Junior Member
Hi All,

I am trying to implement rotate feature in custom feature provider for pictogram element(polygon). I am not sure how to achieve this. I have a tab strip with rotate for the pictogram element. I need to implement rotate functionality for the pictogram element.
Please find the attached image for clarity.
index.php/fa/6573/0/


public class LaneSwitchDirectionCustomFeature extends AbstractPMCustomFeature{

	public LaneSwitchDirectionCustomFeature(ICustomContext context, IFeatureProvider fp) {
		super(context, fp);
	}

	@Override
	public String getImageId() {
		return PMToolSpecificImageProvider.IMG_ROTATE;
	}	
	
	@Override
	public void execute(ICustomContext context) {
		execute((IContext) context);
	}

	@SuppressWarnings("restriction")
	@Override
public void execute(IContext context) {
		ContainerShape containerShape = null;
		if(context instanceof CustomContext){
			CustomContext cContext = (CustomContext) context;
				if(cContext.getInnerPictogramElement() instanceof ContainerShape){     
					containerShape = (ContainerShape) cContext.getInnerPictogramElement();
				}
		}
		else if(context instanceof PictogramElementContext){
			containerShape = (ContainerShape) ((PictogramElementContext) context).getPictogramElement();
		}
		
		if(containerShape!=null){
			GraphicsAlgorithm ga = containerShape.getGraphicsAlgorithm();


Graphics algorithm do not have built in rotate methods. Do we need to redraw the pictogram element by specifying coordinate points? Is there any best option to achieve this?Even after rotating the pictogram element the tab strip should appear.

Thanks in Advance.

Regards,
Vinod
Re: Implement Rotate method for Pictogram Element [message #771889 is a reply to message #771139] Wed, 28 December 2011 13:10 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hi Vinod,

Graphiti can only rotate Texts (and new MultiTexts) but not pictogram
elements in general. So you wil have to do the rotation by calculating and
setting appropriate coordinates for your polygon points.

HTH,
Michael
Previous Topic:Collapse Feature: how to hide an element?
Next Topic:Other types of ConnectionRouter?
Goto Forum:
  


Current Time: Tue Apr 23 09:56:32 GMT 2024

Powered by FUDForum. Page generated in 0.03191 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top