VintaSoft Imaging .NET SDK and Plug-ins Discussions
Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.
Board index < VintaSoft Imaging < VintaSoft Imaging .NET SDK and Plug-ins Discussions
I did some more tests and it seems the FocusedAnnotation of the AnnotationVisualTool is correctly set on the mouseUp event but not on the MouseDown.Do you mean an annotation gets focus only when you release mouse button? Please check our Annotation Demo and let me know if you will have any problem.
IPolygonData selectedPolygonData = null;
if (historyDirection.Equals(PolygonHistoryDirection.Back))
{
selectedPolygonData = (RectangleData)selectedPolygon.GoToPreviousStateAndGet();
}
else
{
selectedPolygonData = (RectangleData)selectedPolygon.GoToNextStateAndGet();
}
// Apply the new state on the focused(selected) annotationViewData
AnnotationDataState annotationDataState = new AnnotationDataState(annotationView.Data)
{
Location = ((RectangleData)selectedPolygonData).Rectangle.Location,
Size = ((RectangleData)selectedPolygonData).Rectangle.Size
};
annotationDataState.Apply(GetSelectedAnnotationView().Data);
annotationView = AnnotationViewFactory.CreateView(new PolygonAnnotationData()); annotationView.Name = annotationView.Data.Guid.ToString(); View.GetAnnotationViewer().AddAndBuildAnnotation(annotationView);
IPolygonData selectedPolygonData = null;
if (historyDirection.Equals(PolygonHistoryDirection.Back))
{
selectedPolygonData = (PolygonPointsData)selectedPolygon.GoToPreviousStateAndGet();
}
else
{
selectedPolygonData = (PolygonPointsData)selectedPolygon.GoToNextStateAndGet();
}
// Apply the new state on the focused(selected) annotationViewData
var data = ((PolygonAnnotationData) GetSelectedAnnotationView().Data);
AnnotationPointCollection annoPointCollection = data.Points;
annoPointCollection.Clear();
foreach (var point in ((PolygonPointsData)selectedPolygonData).Points)
{
annoPointCollection.Add(point);
}
My function to create the polygon annotation view from my point list: private AnnotationView CreatePolygonPointsAnnotationView(List<PointF> pointsList, string toolTip, string name)
{
PolygonAnnotationData polyPointsAnnotationData = new PolygonAnnotationData
{
CanResize = true,
ToolTip = toolTip,
CanRotate = false,
FillBrush = new AnnotationSolidBrush(Color.Transparent),
Border = true,
Outline = { Brush = new AnnotationSolidBrush(Color.Blue), Width = 1 }
};
foreach (var point in pointsList)
{
polyPointsAnnotationData.Points.Add(point);
}
return new PolygonAnnotationView(polyPointsAnnotationData) { Name = name };
}
Is there a special class to build the polygon point based annotation that I missed? Or just doing it wrong?View.GetAnnotationViewer().AddAndBuildAnnotation(annotationView)I can stop it by double right clicking my annotationViewer, it finishes the annotation with the current position of the mouse, I would like to stop it by pressing enter for example, or a single right click.
I need to move the polygon around my AnnotationViewer and store it's coordinates each time it moves.SDK has the Vintasoft.Imaging.Annotation.UI.Undo.AnnotationViewCollectionUndoMonitor and Vintasoft.Imaging.Annotation.UI.Undo.AnnotationViewUndoMonitor classes which allow to add undo/redo functionality to your application. Why dont you use these classes? Annotation Demo shows how to use these classes for managing changes in annotations.
I have undo/redo buttons, it's working well on the rectangle annotation but not on the polygon annotation.
I would also like to know how to stop the drawing of an point polygonYou can finish the annotation building using the AnnotationVisualTool.FinishAnnotationBuilding method:
Hello Jerome,I didn't see these classes and didn't pay attention to that functionality in the annotation demo, I will look into it but I won't be able to use it in my project.
SDK has the Vintasoft.Imaging.Annotation.UI.Undo.AnnotationViewCollectionUndoMonitor and Vintasoft.Imaging.Annotation.UI.Undo.AnnotationViewUndoMonitor classes which allow to add undo/redo functionality to your application. Why dont you use these classes? Annotation Demo shows how to use these classes for managing changes in annotations.
You can finish the annotation building using the AnnotationVisualTool.FinishAnnotationBuilding method:Ok I'll use that function.
https://www.vintasoft.com/docs/vsimaging ... lding.html
You can cancel the annotation building using the AnnotationVisualTool.CancelAnnotationBuilding method:
https://www.vintasoft.com/docs/vsimaging ... lding.html