public void setElementsToMagneticLine(MagneticLine magneticLine){
        ArrayList<ComplexElement> complexElements = new ArrayList<ComplexElement>();
        if(this.graph instanceof PetriNet){
            PetriNet petri = (PetriNet)this.graph;
            for (Place element : petri.getListOfPlaces()) {
                complexElements.add(element);
            }
            for (Resource element : petri.getListOfResources()) {
                complexElements.add(element);
            }
            for (Transition element : petri.getListOfTransitions()) {
                complexElements.add(element);
            }
        }else if(this.graph instanceof PrecedenceGraph){
            PrecedenceGraph precedence = (PrecedenceGraph)this.graph;
            for (Node element : precedence.getListOfNodes()) {
                complexElements.add(element);
            }
        }
        
        magneticLine.addElementsToMagneticLine(complexElements);
    }