Loading...
Searching...
No Matches
Curve::Model Class Referencefinal
Inheritance diagram for Curve::Model:
IdentifiedObject< Model > IdentifiedObjectAbstract

Public Member Functions

 Model (const Id< Model > &, QObject *parent)
 
template<typename Impl >
 Model (Impl &vis, QObject *parent)
 
void addSegment (SegmentModel *m)
 
void insertSegment (SegmentModel *)
 
void removeSegment (SegmentModel *m)
 
void loadSegments (const std::vector< SegmentModel * > &models)
 Takes ownership of freshly deserialized segments.
 
const std::vector< SegmentModel * > & sortedSegments () const noexcept
 Segments chain by chain, which for a valid curve is by increasing x.
 
std::vector< SegmentData > toCurveData () const
 
void toCurveData (std::vector< SegmentData > &out) const
 Same, reusing the storage of out.
 
void fromCurveData (const std::vector< SegmentData > &curve)
 
void applyChanges (std::span< const Id< SegmentModel > > removed, std::span< const SegmentData *const > upserted)
 
Selection selectedChildren () const
 
void setSelection (const Selection &s)
 
void clear ()
 
const auto & segments () const
 
auto & segments ()
 
const std::vector< PointModel * > & points () const
 Chain by chain, which for a valid curve is by increasing x.
 
std::vector< PointModel * > & points ()
 
double lastPointPos () const
 
std::optional< double > valueAt (double x) const noexcept
 
void segmentAdded (const SegmentModel *arg_1)
 
void segmentRemoved (const Id< SegmentModel > &arg_1)
 
void changed ()
 
void curveReset ()
 
void cleared ()
 
- Public Member Functions inherited from IdentifiedObject< Model >
 IdentifiedObject (id_type id, const QString &name, QObject *parent) noexcept
 
 IdentifiedObject (Visitor &&v, QObject *parent) noexcept
 
const id_type & id () const noexcept
 
int32_t id_val () const noexcept final override
 
void setId (const id_type &id) noexcept
 
void setId (id_type &&id) noexcept
 
void resetCache () const noexcept override
 
- Public Member Functions inherited from IdentifiedObjectAbstract
void identified_object_destroying (IdentifiedObjectAbstract *o)
 To be called by subclasses.
 
void identified_object_destroyed (IdentifiedObjectAbstract *o)
 Will be called in the IdentifiedObjectAbstract destructor.
 

Additional Inherited Members

- Public Types inherited from IdentifiedObject< Model >
using model_type = Model
 
using id_type = Id< Model >
 
using object_type = IdentifiedObject< Model >
 
- Public Attributes inherited from IdentifiedObject< Model >
Path< Model > m_path_cache
 
- Static Public Attributes inherited from IdentifiedObject< Model >
static const constexpr bool identified_object_tag
 
- Protected Member Functions inherited from IdentifiedObjectAbstract
 IdentifiedObjectAbstract (const QString &name, QObject *parent) noexcept
 

Member Function Documentation

◆ addSegment()

void Curve::Model::addSegment ( SegmentModel *  m)

Inserts a segment and recomputes the points: O(N), for building a curve a segment at a time. Edits go through applyChanges / fromCurveData.

◆ applyChanges()

void Curve::Model::applyChanges ( std::span< const Id< SegmentModel > >  removed,
std::span< const SegmentData *const >  upserted 
)

Removes the removed segments, then updates each of upserted in place (or creates it). Segments whose links do not change keep their points: the cost is that of the change, plus O(N) when the chains change.

◆ fromCurveData()

void Curve::Model::fromCurveData ( const std::vector< SegmentData > &  curve)

Replaces the curve. Refused, with a warning, if curve is not valid (see isValidCurve) or uses an unknown segment type.


The documentation for this class was generated from the following files: