Page MenuHomePhabricator

Serialization of Planar Figures
Closed, ResolvedPublic

Description

As it is senseless to save PlanarFigures on their own one must implement the Serialization of Planar Figures to work with Scene Serialization

Related Objects

Event Timeline

this patch contains an initial version of an xml based reader and writer class for planar figures.

These classes save and restore all 4 variants of planar figures.

Currently, only control points are saved. The polyline is re-created from the control points. Other properties like m_FigurePlaced and m_SelectedControlPoint or polygon closed are not saved and loaded at the moment.

The most important missing aspect is that the Geometry2D is currently not saved!

These classes need to be registered in the file io factory mechanism.
Then, they need to be wrapped in a serializer and deserializer for the SceneSerialization.

I'll be gone till monday, if this is urgent, someone else needs to continue the work.

[SVN revision 20018]
ENH (#2760): add optional bool parameter to SetControlPoint to allow setting control points with arbitrary id (needed for loading of planar figures)

[SVN revision 20019]
ENH (#2760): Add Reader and Writer classes for PlanarFigure subclasses, add corresponding factories

[SVN revision 20020]
ENH (#2760): Add serializer for PlanarFigure subclasses

With the last few commits, it is possible to serialize and deserialize planar figures.

There are still some unresolved issues:

  • The IO factory for reading planar figures seems to be not working. It is not possible to load planar figures with File/Open. But this is not intended anyways...
  • currently, only the control points are saved. The Geometry2D is not saved yet. This is the next thing I'll implement.
  • If PlanarFigure subclasses have more properties that need to be saved, this has to be implemented too.
  • There is no unit test yet

[SVN revision 20051]
ENH (#2760): save and restore the PlaneGeometry of the PlanarFigure

[SVN revision 20056]
ENH (#2760): call PlaceFigure() on loading to initialize the PlanarFigure correctly.

Serialization of PlanarFigures seems to be working as far as I can tell. Michael, Mathias, please test and close this bug or report any open issues.

With the following steps, an error occured on my system with saving/reloading of PlanarFigures as seen in the screenshot:

  • Loaded Pic3D.pic
  • Created on polyon, one line, and one circle
  • Each PlanarFigure is in one of the three standard views
  • Saved project, closed the application, loaded project file again
  • The scene is displayed as in the screenshot
  • Strangely, when scrolling through the slices, all three (distorted) PlanarFigures are displayed simultaneously in all three views, not only on a particular slice (as it should be)

MeasurementSerializationError.png (1×814 px, 134 KB)

(In reply to comment #10)

Created an attachment (id=372) [details]
Error with serialization/de-serialization of PlanarFigure

With the following steps, an error occured on my system with saving/reloading
of PlanarFigures as seen in the screenshot:

  • Loaded Pic3D.pic
  • Created on polyon, one line, and one circle
  • Each PlanarFigure is in one of the three standard views
  • Saved project, closed the application, loaded project file again
  • The scene is displayed as in the screenshot
  • Strangely, when scrolling through the slices, all three (distorted)

PlanarFigures are displayed simultaneously in all three views, not only on a
particular slice (as it should be)

Is this a problem of the serialization or of the mapper?
Can you tell me what exactly is needed to recreate the Geometry of the PlanarFigure?

nothing to add. tried the same on linux with the same result. all figures remain in every slice of the picture

[SVN revision 20164]
FIX (#2760): Use axis vectors, origin, and spacing for saving/loading PlaneGeometry for PlanarFigures

[SVN revision 20165]
ENH (#2760): Added PlanarRectangle to serialization

Writing/reading of PlanarFigures seems to work now. Selection of the correct planes is now also working properly since the fixes in T795.

Setting bug to FIXED.

(In reply to comment #15)

Writing/reading of PlanarFigures seems to work now. Selection of the correct
planes is now also working properly since the fixes in T795.

Setting bug to FIXED.

EDIT: selection bug is #2795, not #795

Merging "applicazion modules" component with "ExtApp plugins"