71 EditFlat(
const EditFlat &);
94 DefaultVisitor(line, false, false), newLine(toLine), reference(refer) {
103 void EditFlat::visitDrift(
const Drift &drift) {
109 void EditFlat::visitMarker(
const Marker &marker) {
111 if(name[0] !=
'#') applyDefault(marker);
115 void EditFlat::applyDefault(
const ElementBase &element) {
138 newLine.push_back(member);
153 itsSequence(seq), itsLine(), isModified(false), parser() {
179 for(
iterator start = first; start != last;) {
184 for(
iterator i = first; i != start;) {
185 (*i).itsPosition += length;
204 double startPos = (*first).itsPosition;
205 for(
iterator i = first; i != last;) {
206 (*i).itsPosition -= startPos;
316 const std::string &typ,
const std::string &patt) {
347 newList.push_back(member1);
356 newList.push_back(member2);
371 for(
iterator i = first; i != last;) {
372 if(i->getSelectionFlag()) {
376 install(newList, elm, i->itsPosition + at);
381 if(dynamic_cast<FlaggedBeamline *>(base)) {
383 }
else if(
TLine *line = dynamic_cast<TLine *>(base)) {
409 for(
iterator i = first; i != last;) {
414 invalidShare(
"INSTALL");
416 install(newList, elm, i->itsPosition + at);
421 if(dynamic_cast<FlaggedBeamline *>(base)) {
422 invalidLine(
"INSTALL");
423 }
else if(
TLine *line = dynamic_cast<TLine *>(base)) {
424 count += installSingle(shared || base->
isSharable(),
450 for(
iterator i = first; i != last;) {
451 double sOld = i->itsPosition;
456 while(k != newList.end() && k->itsPosition < sOld) {
462 bl.splice(i, newList, j, k);
472 if(! newList.empty()) {
473 bl.splice(last, newList, newList.begin(), newList.end());
492 for(
iterator i = first; i != last;) {
497 if(j->getSelectionFlag()) {
502 j->itsPosition += by;
503 newList.splice(newList.end(), bl, j, i);
509 if(dynamic_cast<FlaggedBeamline *>(base)) {
511 }
else if(
TLine *line = dynamic_cast<TLine *>(base)) {
535 for(
iterator i = first; i != last;) {
547 newList.splice(newList.end(), bl, j, i);
553 if(dynamic_cast<FlaggedBeamline *>(base)) {
555 }
else if(
TLine *line = dynamic_cast<TLine *>(base)) {
582 for(
iterator i = first; i != last;) {
590 invalidShare(
"MOVE");
592 double fromPos = 0.0;
594 for(
iterator k = bl.begin(); k != bl.end(); ++k) {
597 fromPos = k->itsPosition + by;
603 "\"FROM\" position not found.");
607 j->itsPosition = fromPos;
608 newList.splice(newList.end(), bl, j, i);
615 if(dynamic_cast<FlaggedBeamline *>(base)) {
617 }
else if(
TLine *line = dynamic_cast<TLine *>(base)) {
618 count += moveSingleRel(shared || base->
isSharable(),
619 *line, it, from, by);
631 double length = bl.back().itsPosition;
633 newLine->push_front(bl.back());
639 for(
iterator i = first; i != last; ++i) {
643 newLine->push_front(member);
646 newLine->push_front(bl.front());
664 for(
iterator i = first; i != last;) {
669 if(j->getSelectionFlag()) {
680 if(dynamic_cast<FlaggedBeamline *>(base)) {
682 }
else if(
TLine *line = dynamic_cast<TLine *>(base)) {
704 for(
iterator i = first; i != last;) {
724 if(dynamic_cast<FlaggedBeamline *>(base)) {
726 }
else if(
TLine *line = dynamic_cast<TLine *>(base)) {
748 for(
iterator i = first; i != last;) {
749 if(i->getSelectionFlag()) {
764 if(dynamic_cast<FlaggedBeamline *>(base)) {
766 }
else if(
TLine *line = dynamic_cast<TLine *>(base)) {
791 for(
iterator i = first; i != last;) {
809 if(dynamic_cast<FlaggedBeamline *>(base)) {
811 }
else if(
TLine *line = dynamic_cast<TLine *>(base)) {
827 std::cerr <<
"\n### Warning ### You cannot apply \"" << cmd
828 <<
"\" on a nested \"LINE\".\n" <<
std::endl;
835 std::cerr <<
"\n### Warning ### You cannot apply \"" << cmd
836 <<
"\" on a nested shared object.\n" <<
std::endl;
Sequence::TLine TLine
The type of line contained in a sequence.
virtual void visitDrift(const Drift &)
Apply the algorithm to a drift.
int installMultiple(ElementBase *, double)
Install multiple elements.
Interface for basic beam line object.
virtual TLine * fetchLine() const
Return the embedded CLASSIC beam line.
Pointer< TLine > itsLine
The edit sequence.
void define(Object *newObject)
Define a new object.
void copyAttributes(const Object &)
Copy attributes from another object.
virtual void applyDefault(const ElementBase &)
The base class for all OPAL exceptions.
virtual void setName(const std::string &name)
Set element name.
virtual ElementBase * removeWrappers()
Return the design element.
void selectClear()
Clear all selection flags.
virtual const std::string & getName() const
Get element name.
void operator=(const DefaultVisitor &)
Interface for drift space.
bool isActive() const
Return status.
void selectFull()
Set all selection flags.
double itsPosition
The position attribute ("AT" or "DRIFT").
void insertDrifts(TLine &line)
bool isModified
Modify flag.
void invalidShare(const char msg[])
Pointer< Sequence > itsSequence
The original sequence.
Set selection flags for a given range in a beam line.
ReferenceType getReference() const
Return the reference type flag.
Representation of a place within a beam line or sequence.
virtual void visitMarker(const Marker &)
Apply the algorithm to a marker.
static OpalData * getInstance()
int replaceSingle(const PlaceRep &, ElementBase *elem)
Replace single element.
const std::string & getOpalName() const
Return object name.
MemberType itsType
Type word.
Template class for beam lines.
The base class for all OPAL elements.
virtual double getElementLength() const
Get design length.
ReferenceType
Reference for element positioning.
void addEndMarkers(TLine &line) const
int moveSingleAbs(const PlaceRep &, double to)
Move single element.
void enter(const FlaggedElmPtr &) const
Enter an element or line.
Sequence::TLine::iterator iterator
The line iterator for a sequence.
void storeLine(TLine &line)
Store sequence line.
int installSingle(const PlaceRep &, ElementBase *, double)
Install element relative to place.
void reflect()
Reflect the edit sequence.
virtual ElementBase * copyStructure()
Make a structural copy.
Set/reset all selection flags in a beam line built from FlaggedElmPtr.
void initialize()
Initialise data for search.
static Edit * block
Pointer to the edit data.
Representation of a range within a beam line or sequence.
void leave(const FlaggedElmPtr &) const
Leave an element or line.
An abstract sequence of beam line components.
virtual Sequence * clone(const std::string &name)
Make clone.
virtual void execute()
Apply the algorithm to the top-level beamline.
bool cycle(const PlaceRep &start)
Cycle the edit sequence.
ElementBase * getElement() const
Return the embedded CLASSIC element.
static Element * find(const std::string &name)
Find named Element.
virtual Sequence * copy(const std::string &name)
Make copy of the sequence line.
This class contains all data for the sequence editor.
void merge(TLine &, TLine &)
virtual double getLength() const
Return sequence length.
void invalidLine(const char msg[])
Object * find(const std::string &name)
Find entry.
void install(TLine &, ElementBase *, double)
int removeSingle(const PlaceRep &)
Remove single element.
bool getReflectionFlag() const
Get reflection flag.
int removeMultiple()
Remove multiple elements.
bool isSharable() const
Test if the element can be shared.
void finish(const std::string &newName)
Finish editing.
int moveSingleRel(const PlaceRep &, const PlaceRep &, double to)
Move single element.
int select(const RangeRep &rng, const std::string &cls, const std::string &typ, const std::string &patt)
Select elements in the edit sequence.
virtual void execute()
Execute the selection.
int replaceMultiple(ElementBase *elem)
Replace multiple elements.
virtual void update()
Update the embedded CLASSIC beam line.
int moveMultiple(double by)
Move multiple elements.
int getCount() const
Return the count of selected elements.
Representation for a drift space.
Inform & endl(Inform &inf)
void makeDirty(Object *object)
Invalidate expressions.
void flatten()
Flatten the edit sequence.
Pointer< Element > OpalElement
void setElement(ElementBase *)
Set the element pointer.
void setReflectionFlag(bool flag) const
Set reflection flag.