2013-02-05 3 views
0

Annotation 개체를 그래프에서 선택, 이동, 크기 조정 또는 삭제할 수 있습니까?JUNG 그래프에서 주석을 선택/이동/크기 조정/삭제

편집 : 라인 174에 (

// Get the RenderContext for this visualization viewer 
RenderContext<String,Number> rc = vv.getRenderContext(); 

// Create a new AnnotatingGraphMousePlugin with default settings. 
// The AnnotatingGraphMousePlugin class is a subclass of AbstractGraphMousePlugin 
// and also implements the interfaces MouseListener and MouseMotionListener. As 
// such, the respective overridden methods would be a interesting place to embed 
// the logic for the required behavior. However I am still not sure! 
AnnotatingGraphMousePlugin<String,Number> annotatingPlugin = 
     new AnnotatingGraphMousePlugin<String,Number>(rc); 

// Create a GraphMouse for the main view, using the annotating mouse plugin. 
final AnnotatingModalGraphMouse<String,Number> graphMouse = 
     new AnnotatingModalGraphMouse<String,Number>(rc, annotatingPlugin); 

과 :

은 (@sdasdadas 인용)을 AnnotationDemo을 고려하면, 관심있는 다음 코드 (줄 126-134에서) 확인되었다 -180) :

// Create annotation controls to allow the selection of color, shape, fill, 
// and z-order. None of these controls is of interest to us. 
AnnotationControls<String,Number> annotationControls = 
     new AnnotationControls<String,Number>(annotatingPlugin); 

위의 설명에 기초하여, 나의 초기 질문은 동일하게 유지됩니다.


답변

1

예, AnnotationsDemo을 살펴보십시오.

+0

내 업데이트 된 질문을 참조하십시오. – rkmylo

+0

@rkmylo 사과하겠습니다. 제 답변이 너무 짧았습니다.하지만 너무 많이 확장 할 수는없는 것 같습니다. 주석을 그리는 것이 가능할 때, picking, resizing 등은 커스텀 마우스 리스너와 로직을 필요로 할 수 있습니다. EG. 마우스가 해당 주석 중 하나의 도메인 내에 있으면 마우스로 클릭하여 주석 및 좌표 목록을 유지하십시오. 그렇다면 그것을 선택하십시오 ... 당신은'mouseDragged()'로 비슷한 일을 할 수 있습니다. – sdasdadas