Loading...
Searching...
No Matches
AlignSVG.h
1/*
2
3MIT License
4
5Copyright (c) 2023 FMI Open Development / Markus Peura, first.last@fmi.fi
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26/*
27Part of Rack development has been done in the BALTRAD projects part-financed
28by the European Union (European Regional Development Fund and European
29Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30*/
31/*
32 * TreeSVG.h
33 *
34 * Created on: Nov, 2024
35 * Author: mpeura
36 */
37
38#ifndef DRAIN_ALIGN_SVG
39#define DRAIN_ALIGN_SVG
40
41//#include "drain/util/FileInfo.h"
42// #include "drain/util/Frame.h"
43//
44#include <string>
45#include "drain/util/EnumFlags.h"
46
47namespace drain {
48
49namespace image {
50
51
53struct AlignBase {
54
55public:
56
58 enum Pos {
59 UNDEFINED_POS = 0,
60 MIN = 1, // LEFT (if HORZ) or TOP (when VERT) 0b01010101,
61 MAX = 2, // RIGHT (if HORZ) or BOTTOM (when VERT) 0b10101010,
62 MID = 3, // 0b11111111,
63 FILL = 4,
64 // ABSOLUTE?
65 };
66
67 enum Axis {
68 // Index, must contain 0 and 1 for HORZ and VERT
69 HORZ = 0, // 0b00110011,
70 VERT = 1, // b11001100,
71 UNDEFINED_AXIS = 2,
72 };
73
74 static inline
75 Axis flip(Axis axis){
76 switch (axis){
77 case HORZ:
78 return AlignBase::VERT;
79 case VERT:
80 return HORZ;
81 default:
82 return UNDEFINED_AXIS;
83 }
84 };
85
86 //typedef drain::EnumDict<Coord>::dict_t pos_dict_t;
87
88 static inline
90 switch (pos){
91 case MAX:
92 return MIN;
93 case MIN:
94 return MAX;
95 case MID:
96 case FILL:
97 case UNDEFINED_POS:
98 default:
99 return pos;
100 }
101 };
102
103};
104
105
106template <>
108DRAIN_ENUM_OSTREAM(AlignBase::Axis);
109
110template <>
112DRAIN_ENUM_OSTREAM(AlignBase::Pos);
113
114
116
125template <typename AX = AlignBase::Axis, AlignBase::Axis A = AlignBase::Axis::UNDEFINED_AXIS, typename POS = AlignBase::Pos> // , Align::Coord POS = Align::Coord::UNDEFINED_POS>
126struct Alignment {
127
128 // Align::Axis
129 AX axis; // = V; // compiler error if different type?
130
131 //AlignBase::Pos pos
132 POS pos = AlignBase::Pos::UNDEFINED_POS; // or middle?
133
135 inline
136 Alignment(AlignBase::Pos pos = AlignBase::Pos::UNDEFINED_POS) : axis(A), pos(pos){
137 }
138
140 inline
141 Alignment(const Alignment & ac) : axis(ac.axis), pos(ac.pos){
142 }
143
144
145 inline
146 Alignment(AlignBase::Axis axis, AlignBase::Pos pos = AlignBase::Pos::UNDEFINED_POS): axis(axis), pos(pos){
147 }
148
149 template <typename AX2, AlignBase::Axis A2>
150 inline
151 Alignment(const Alignment<AX2,A2> & align) : pos(align.pos){ // axis(ac.axis),
152 axis = align.axis; // error if const
153 }
154
156 inline virtual
158
159 /*
160 template <typename T>
161 bool isSet2();
162
163 virtual inline
164 bool isSet() const {
165 return (axis != AlignBase::Axis::UNDEFINED_AXIS) && (pos != AlignBase::Pos::UNDEFINED_POS);
166 }
167 */
168
169 inline
170 const AlignBase::Axis & get(const AlignBase::Axis & defaultValue) const {
171 if (axis != AlignBase::Axis::UNDEFINED_AXIS){
172 return axis;
173 }
174 else {
175 return defaultValue;
176 }
177 }
178
179 inline
180 const AlignBase::Pos & get(const AlignBase::Pos & defaultValue) const {
181 if (pos != AlignBase::Pos::UNDEFINED_POS){
182 return pos;
183 }
184 else {
185 return defaultValue;
186 }
187 }
188
189
190 virtual inline
191 void reset(){
192 axis = AlignBase::Axis::UNDEFINED_AXIS;
193 pos = AlignBase::Pos::UNDEFINED_POS;
194 }
195
196
197 template <typename AX2, AlignBase::Axis A2>
198 inline
199 bool operator==(const Alignment<AX2,A2> & align) const {
200 return (align.axis == axis) && (align.pos == pos);
201 // return compare(ad) == 0;
202 }
203
204
205};
206
207/*
208template <typename AX, AlignBase::Axis A, typename POS>
209template <>
210bool Alignment<AX,A,POS>::isSet2<AlignBase::Axis>(){
211 return axis != AlignBase::Axis::UNDEFINED_AXIS;
212};
213
214template <typename AX, AlignBase::Axis A, typename POS>
215//template <>
216bool Alignment<AX,A,POS>::isSet2<AlignBase::Pos>(){
217 return axis != AlignBase::Pos::UNDEFINED_POS;
218};
219*/
220
221/*
222template <typename AX, AlignBase::Axis A, typename POS>
223template <>
224const AlignBase::Axis & Alignment<AX,A,POS>::get(const AlignBase::Axis & defaultValue){
225 if (isSet<AlignBase::Axis>()){
226 return axis;
227 }
228 else {
229 return defaultValue;
230 }
231};
232
233template <typename AX, AlignBase::Axis A, typename POS>
234template <>
235const AlignBase::Pos & Alignment<AX,A,POS>::get(const AlignBase::Pos & defaultValue){
236 if (isSet<AlignBase::Pos>()){
237 return pos;
238 }
239 else {
240 return defaultValue;
241 }
242};
243
244template <typename AX, AlignBase::Axis A, typename POS>
245template <>
246const AlignBase::Axis & Alignment<AX,A,POS>::get(const AlignBase::Axis & defaultValue) const {
247 if (axis != AlignBase::Axis::UNDEFINED_AXIS){
248 return axis;
249 }
250 else {
251 return defaultValue;
252 }
253};
254*/
255
256
257template <typename AX, AlignBase::Axis V>
258inline
259std::ostream & operator<<(std::ostream &ostr, const Alignment<AX,V> & align){
260 //return ostr << align.axis << '_' << align.pos; // enums resolved above
261 return ostr << align.axis << '_' << align.pos;
262}
263
264
265
266
267//struct Alignment2;
268
270
276struct AlignSVG { // : protected Align {
277
278
279 virtual
280 ~AlignSVG(){};
281
283
285 static
286 const HorzAlign LEFT; // ,Coord::MIN
287
289 static
291
293 static
295
297 static
299
300 static
301 const HorzAlign UNDEFINED_HORZ;
302
303 // ----------------------
304
306
308 static
310
312 static
314
316 static
318
320 static
322
323 static
324 const VertAlign UNDEFINED_VERT;
325
326
327 enum Owner {
328 OBJECT = 0, // 0b00001111,
329 ANCHOR = 1, // 0b11110000,
330 };
331
332
333 enum Topol {
334 INSIDE = 0,
335 OUTSIDE = 1,
336 UNDEFINED_TOPOL = 2,
337 };
338
339
341 /*
342 * Notice that for an alignment to be complete, this function should be called twice:
343 * setting partial alignment for both owner=OBJECT and owner=ANCHOR .
344 *
345 * \tparam OBJ - enum type \c Owner or string
346 * \tparam A - enum type \c Axis or string
347 * \tparam V - enum type \c Alignment or string
348 * \param pos - enum value \c OBJ or \c REF
349 * \param axis - enum value \c HORZ or \c VERT
350 * \param value - enum value \c MAX , \c MID , or \c MIN (or string)
351 */
352 template <typename OBJ, typename A, typename V>
353 inline // in problems, rename this function, ie. remove polymorphism
354 void setAlign(const OBJ & owner, const A & axis, const V &value){
355 modifyAlign(owner, axis, value);
356 updateAlign();
357 }
358
360
369 inline
370 void setAlign(const AlignBase::Axis & axis, const AlignBase::Pos & pos, Topol topol=Topol::INSIDE){
371 modifyAlign(ANCHOR, axis, pos);
372 modifyAlign(OBJECT, axis, (topol==INSIDE) ? pos : AlignBase::flip(pos));
373 updateAlign();
374 }
375
377 /*
378 * Template supports empty arg list.
379 *
380 * \tparam T - enum type \c Topol or string
381 * \tparam AX - axis enum type: Axis or const Axis
382 * \tparam A - axis enum value: HORZ, VERT or UNDEFINED_AXIS
383 * \param align - \c HorzAlign or \c VertAlign
384 */
385 template <typename ...T, typename AX, AlignBase::Axis A>
386 void setAlign(const Alignment<AX,A> & align, const T... args){
387 if (align.pos == AlignBase::FILL){
388 // Makes sense only for OBJECT, as it will be changed (and ANCHOR is never unchanged).
389 setAlign(AlignSVG::OBJECT, align.axis, align.pos);
390 }
391 else {
392 setAlign(align.axis, align.pos, args...);
393 }
394 }
395
396 // Convenience: set both horz and vert alignments (INSIDE)
397 /*
398 */
399 template <typename AX1, AlignBase::Axis A1, typename AX2, AlignBase::Axis A2>
400 void setAlign(const Alignment<AX1,A1> & align1, const Alignment<AX2,A2> & align2){
401 setAlign(align1.axis, align1.pos, AlignSVG::Topol::INSIDE);
402 setAlign(align2.axis, align2.pos, AlignSVG::Topol::INSIDE);
403 }
404
406 template <typename AX, AlignBase::Axis A>
407 void setAlign(const Alignment<AX,A> & align1, const Alignment<AX,A> & align2);
408
409
411 /*
412 * \tparam T - enum type \c Topol or string: \c INSIDE or \c OUTSIDE .
413 * \param align - Horizontal or vertical Alignment: \c LEFT|CENTER|RIGHT or \c TOP|MIDDLE|BOTTOM
414 * \param topol - \c INSIDE or \c OUTSIDE
415 */
416 template <typename T>
417 void setAlign(const std::string & align, const T & topol){
418 const Alignment<> & a = EnumDict<Alignment<> >::getValue(align, false);
419 const Topol & t = EnumDict<AlignSVG::Topol>::getValue(topol, false);
420 //const Alignment<> & a = EnumDict<Alignment<> >::getValue(align, false);
421 setAlign(a.axis, a.pos, t);
422 }
423
425
427 void setAlign(const std::string & align);
428 // Note: no mixed type, ANCHOR:LEFT
429
431 bool isAligned() const;
432
433 void resetAlign();
434
436 /*
437 * \tparam P - enum type Owner \c REF or \c OBJ , or respective string.
438 * \tparam A - enum type axis_t \c HORZ or \c VERT , or respective string.
439 * \param pos - target object \c OBJ or referred anchor object \c REF
440 * \param axis - horizontal \c HORZ or vertical \c AXIS .
441 */
442 template <typename P, typename A>
443 AlignBase::Pos & getAlign(const P & pos, const A & axis);
444
445
447 /*
448 * \tparam P - enum type Owner \c REF or \c OBJ , or respective string.
449 * \tparam A - enum type axis_t \c HORZ or \c VERT , or respective string.
450 * \param pos - target object \c OBJ or referred anchor object \c REF
451 * \param axis - horizontal \c HORZ or vertical \c AXIS .
452 *
453 */
454 template <typename P, typename A>
455 const AlignBase::Pos & getAlign(const P & pos, const A & axis) const;
456
460 void confToStream(std::ostream & ostr) const;
461
462 /*
464 template <typename ...TT>
465 bool isAlignSet(const TT... args) const {
466 bitvect_t v = combineAlign(args...);
467 return (alignment & v) == v;
468 }
469
470 */
471
472protected:
473
474 // Future extension
475 typedef int bitvect_t; // or int_t ?
476
477 // Future extension
478 mutable
479 bitvect_t alignment = 0;
480
482 template <typename P, typename A, typename V>
483 void modifyAlign(const P & owner, const A & axis, const V &value){
484 getAlign(owner, axis) = EnumDict<AlignBase::Pos>::getValue(value, false);
485 }
486
487 virtual inline
488 void updateAlign(){};
489
490
491 typedef std::vector<AlignBase::Pos> align_vect_t;
492 typedef std::vector<align_vect_t > align_conf_t;
493
494 align_conf_t alignments = align_conf_t(2, align_vect_t(2, AlignBase::Pos::UNDEFINED_POS));
495
497
498
499};
500
501
502inline
503std::ostream & operator<<(std::ostream &ostr, const AlignSVG & align){
504 //return ostr << align.axis << '_' << align.pos; // enums resolved above
505 align.confToStream(ostr);
506 return ostr; // << "UNDER CONSTR..."; // RESOLVE!
507}
508
509
510template <>
512DRAIN_ENUM_OSTREAM(AlignSVG::Owner);
513
514template <>
516DRAIN_ENUM_OSTREAM(AlignSVG::Topol);
517
518template <>
519inline
520void AlignSVG::HorzAlign::reset(){
521 // axis = AlignBase::Axis::UNDEFINED_AXIS;
522 pos = AlignBase::Pos::UNDEFINED_POS;
523}
524
525template <>
526inline
527void AlignSVG::VertAlign::reset(){
528 // axis = AlignBase::Axis::UNDEFINED_AXIS;
529 pos = AlignBase::Pos::UNDEFINED_POS;
530}
531
532DRAIN_TYPENAME(AlignSVG::HorzAlign);
533
534DRAIN_TYPENAME(AlignSVG::VertAlign);
535
537template <>
539// DRAIN_ENUM_OSTREAM(AlignSVG::HorzAlign);
540
542template <>
544// DRAIN_ENUM_OSTREAM(AlignSVG::VertAlign);
545
546
548template <>
550
551
552
553
554template <typename OBJ, typename A>
555AlignBase::Pos & AlignSVG::getAlign(const OBJ & owner, const A & axis){
556 const AlignSVG::Owner p = EnumDict<AlignSVG::Owner>::getValue(owner, false); // raise error
557 const AlignBase::Axis a = EnumDict<AlignBase::Axis>::getValue(axis, false); // raise error
558 return alignments[p][a];
559}
560
561template <typename OBJ, typename A>
562const AlignBase::Pos & AlignSVG::getAlign(const OBJ & owner, const A & axis) const {
563 const AlignSVG::Owner p = EnumDict<AlignSVG::Owner>::getValue(owner, false); // raise error
564 const AlignBase::Axis a = EnumDict<AlignBase::Axis>::getValue(axis, false); // raise error
565 return alignments[p][a];
566}
567
568
569
570
571
572
574
587template <typename AX = AlignBase::Axis, AlignBase::Axis A = AlignBase::Axis::UNDEFINED_AXIS> // , Align::Coord POS = Align::Coord::UNDEFINED_POS>
588struct CompleteAlignment : public Alignment<AX,A> {
589
590 AlignSVG::Topol topol = AlignSVG::Topol::INSIDE; // or undef?
591
593 template <class ...TT>
594 CompleteAlignment(const TT... args) : Alignment<AX,A>() {
595 set(args...);
596 }
597
598 inline
600
601 virtual inline
602 bool isSet() const {
603 return (this->axis != AlignBase::Axis::UNDEFINED_AXIS) &&
604 (this->pos != AlignBase::Pos::UNDEFINED_POS) &&
605 (topol != AlignSVG::Topol::UNDEFINED_TOPOL);
606 // return Alignment<AX,A>::isSet() && (topol != AlignSVG::Topol::UNDEFINED_TOPOL);
607 }
608
609 inline
610 const AlignSVG::Topol & get(const AlignSVG::Topol & defaultValue) const {
611 if (topol != AlignSVG::Topol::UNDEFINED_TOPOL){
612 return topol;
613 }
614 else {
615 return defaultValue;
616 }
617 }
618
619
620 // Sets all members to UNDEFINED state.
621 virtual inline
622 void reset(){
623 Alignment<AX,A>::reset();
624 topol = AlignSVG::Topol::UNDEFINED_TOPOL;
625 // this->updateAlign();
626 }
627
628
629 template <typename AX2, AlignBase::Axis A2, class ...TT>
630 void set(const Alignment<AX2,A2> & align, const TT... args){
631 this->axis = align.axis;
632 this->pos = align.pos;
633 set(args...);
634 }
635
636 template <class ...TT>
637 void set(AlignSVG::Topol topol, const TT... args){
638 this->topol = topol;
639 set(args...);
640 }
641
642 template <class ...TT>
643 void set(AlignBase::Axis axis, const TT... args){
644 this->axis = axis;
645 set(args...);
646 }
647
648 template <class ...TT>
649 void set(AlignBase::Pos coord, const TT... args){
650 this->pos = coord;
651 set(args...);
652 }
653
654 template <class ...TT>
655 void set(const std::string & key, const TT... args){
657 // ok
658 }
659 else if (EnumDict<Alignment<> >::setValue(key, *this)){ // RIGHT or?
660 // ok
661 }
662 else if (EnumDict<AlignBase::Axis>::setValue(key, this->axis)){
663 // ok
664 }
665 else if (EnumDict<AlignBase::Pos>::setValue(key, this->pos)){
666 // ok
667 }
668 else {
669 // Advice: keys
670 throw std::runtime_error(drain::StringBuilder<>("key '", key, "' not found. Appeared in: ", args...));
671 }
672
673 set(args...);
674 }
675
676 template <class ...TT>
677 void set(const char *key, const TT... args){
678 set(std::string(key), args...);
679 }
680
681
682protected:
683
684 inline
685 void set(){
686 // this->updateAlign(); // ok?
687 }
688
689};
690
691
692
693template <typename AX, AlignBase::Axis A>
694std::ostream & operator<<(std::ostream &ostr, const CompleteAlignment<AX,A> & ad){
695 return ostr << ad.topol << '_' << ad.axis << ':' << ad.pos;
696}
697
698
700
704
705public:
706
707
708 //enum Axis {HORZ=0, VERT=1}; // must be indexed! for vect_ UNDEFINED_AXIS=0,
710 AxisFlagger orientation = AlignBase::HORZ;
711
712 enum Direction {
713 UNDEFINED_DIRECTION=0,
714 INCR = 1,
715 DECR = 2,
716 };
718 DirectionFlagger direction = INCR;
719
720 // Experimental CSS classes
721 enum GroupType {
722 HEADER,
723 ALIGN_FRAME,
724 // ALI GNED, // needed? "anchor" attrib and getAlign() should work
725 ABSOLUTE, // "do not align (me or descendants) (future option)"
726 FLOAT, // = element does not affect alignment of other elems
727 };
728
729
730 inline
731 LayoutSVG(AlignBase::Axis v=AlignBase::HORZ, Direction d=INCR) : orientation(v), direction(d) {
732 }
733
734 inline
735 LayoutSVG(const LayoutSVG & layout) : orientation(layout.orientation), direction(layout.direction){
736 }
737
738 template <typename V>
739 inline
740 void setOrientation(const V &v){
741 orientation.set(EnumDict<AlignBase::Axis>::getValue(v));
742 };
743
744 template <typename D>
745 inline
746 void setDirection(const D & d){
748 };
749
751
754 template <typename D, typename V>
755 inline
756 void set(const D & d, const V &v){
758 orientation.set(EnumDict<AlignBase::Axis>::getValue(v));
759 };
760
761
762 /*
763 static inline
764 Direction flip(Direction ...){
765 return ...
766 };
767 */
768
769
770
771};
772
773
774
775template <>
777DRAIN_ENUM_OSTREAM(LayoutSVG::Direction);
778
779template<>
781DRAIN_ENUM_OSTREAM(LayoutSVG::GroupType);
782
783
784
785
787struct AlignAdapterSVG : public AlignSVG {
788
790 template <class T>
791 inline
792 void setAlignAnchor(const T & pathElem){
793 anchorVert = anchorHorz = getElem(pathElem);
794 updateAlign();
795 }
796
797 template <class T>
798 inline
799 void setAlignAnchorHorz(const T & pathElem){
800 anchorHorz = getElem(pathElem);
801 updateAlign();
802 }
803
804 template <class T>
805 inline
806 void setAlignAnchorVert(const T & pathElem){
807 anchorVert = getElem(pathElem);
808 updateAlign();
809 }
810
812 inline
813 const std::string & getAlignAnchorHorz() const {
814 return anchorHorz;
815 }
816
817 inline
818 const std::string & getAlignAnchorVert() const {
819 return anchorVert;
820 }
821
822 inline
823 const std::string & getAlignStr() const {
824 return alignStr;
825 }
826
827 inline virtual
828 ~AlignAdapterSVG(){};
829
830protected:
831
832 static inline
833 const std::string & getElem(const std::string &s){
834 return s;
835 };
836
837 static inline
838 const char * getElem(const char *s){
839 return s;
840 };
841
842 template <class T>
843 static inline
844 const std::string & getElem(const T & type){
845 return EnumDict<T>::dict.getKey(type, false);
846 }
847
848
849 virtual inline
850 void updateAlign() override {
851 updateAlignStr();
852 }
853
854 std::string alignStr;
855
856 std::string anchorHorz;
857 std::string anchorVert;
858
859 void updateAlignStr();
860
861};
862
863
864
865
866
867
868} // image::
869
870} // drain::
871
872
873DRAIN_ENUM_OSTREAM(drain::image::AlignBase::Axis);
874DRAIN_ENUM_OSTREAM(drain::image::AlignBase::Pos);
875
876DRAIN_ENUM_OSTREAM(drain::image::AlignSVG::Owner);
877
878DRAIN_ENUM_OSTREAM(drain::image::LayoutSVG::Direction);
879
880
881#endif // DRAIN_ALIGN_SVG_H_
882
Two-way mapping between strings and objects of template class T.
Definition Dictionary.h:63
Flagger accepting values of enum type E.
Definition EnumFlags.h:190
Definition StringBuilder.h:58
Higher level controller for setting alignments.
Definition AlignSVG.h:703
void set(const D &d, const V &v)
Set direction and orientation.
Definition AlignSVG.h:756
Definition DataSelector.cpp:1277
DRAIN_TYPENAME(void)
Add a specialization for each type of those you want to support.
Wrapper for unique (static) dictionary of enum values.
Definition EnumFlags.h:66
static E getValue(const E &value, bool lenient=true)
Convenience for object.set(...) like commands.
Definition EnumFlags.h:118
static bool setValue(const std::string &key, E &value)
Convenience function for leniently setting string values to separate enum lists.
Definition EnumFlags.h:100
Adapter designed for NodeSVG.
Definition AlignSVG.h:787
void setAlignAnchor(const T &pathElem)
Mark one of the elements of this object (SVG or G) as a decisive position.
Definition AlignSVG.h:792
Low level alignment instructions.
Definition AlignSVG.h:53
Pos
Reference position at Axis (HORZ or VERT)
Definition AlignSVG.h:58
User-friendly programming interface for alignment considering two elements.
Definition AlignSVG.h:276
static const HorzAlign LEFT
Alias for {HORZ:MIN}.
Definition AlignSVG.h:286
static const VertAlign MIDDLE
Alias for {VERT:MID}.
Definition AlignSVG.h:313
void setAlign(const std::string &align, const T &topol)
High-level, user friendlier interface for setting the alignments for both OBJECT itself and its ANCHO...
Definition AlignSVG.h:417
void setAlign(const OBJ &owner, const A &axis, const V &value)
Low-level, "atomic" setter of alignment for OBJECT itself or its ANCHOR object.
Definition AlignSVG.h:354
void setAlign(const AlignBase::Axis &axis, const AlignBase::Pos &pos, Topol topol=Topol::INSIDE)
Set a single alignment setting. "Intermediate-level": axis and pos are given separately.
Definition AlignSVG.h:370
const AlignBase::Pos & getAlign(const P &pos, const A &axis) const
Return alignment setting of an object along horizontal or vertical axis .
void confToStream(std::ostream &ostr) const
Definition AlignSVG.cpp:181
bool isAligned() const
Returns true, if any setting is set...
Definition AlignSVG.cpp:274
static const HorzAlign RIGHT
Alias for {HORZ:MAX}.
Definition AlignSVG.h:294
static const HorzAlign HORZ_FILL
Alias for {HORZ:FILL}.
Definition AlignSVG.h:298
void setAlign(const Alignment< AX, A > &align1, const Alignment< AX, A > &align2)
Compiler trap: unimplemented for two of same kind: either HorzAlign or VertAlign twice.
void modifyAlign(const P &owner, const A &axis, const V &value)
Change alignment configuration without updating the alignStr.
Definition AlignSVG.h:483
static const VertAlign VERT_FILL
Alias for {VERT:FILL}.
Definition AlignSVG.h:321
static const VertAlign BOTTOM
Alias for {VERT:MAX}.
Definition AlignSVG.h:317
void setAlign(const Alignment< AX, A > &align, const T... args)
NEW High-level, user friendlier interface for setting INSIDE the alignments for both OBJECT itself an...
Definition AlignSVG.h:386
static const HorzAlign CENTER
Alias for {HORZ:MID}.
Definition AlignSVG.h:290
static const VertAlign TOP
Alias for {VERT:MIN}.
Definition AlignSVG.h:309
AlignBase::Pos & getAlign(const P &pos, const A &axis)
Return alignment setting of an object along horizontal or vertical axis .
Container for Axis and Pos.
Definition AlignSVG.h:126
Alignment(const Alignment &ac)
Copy constructor.
Definition AlignSVG.h:141
Alignment(AlignBase::Pos pos=AlignBase::Pos::UNDEFINED_POS)
Default constructor.
Definition AlignSVG.h:136
virtual ~Alignment()
Destructor.
Definition AlignSVG.h:157
"Alternative" partial alignment configuration for single object. Partial means that either OBJECT its...
Definition AlignSVG.h:588
CompleteAlignment(const TT... args)
Constructor not setting Axis.
Definition AlignSVG.h:594