Logo Search packages:      
Sourcecode: inkscape version File versions

static Inkscape::XML::Node * sp_spiral_write ( SPObject object,
Inkscape::XML::Node repr,
guint  flags 
) [static]

Virtual write: write spiral attributes to corresponding repr.

Definition at line 141 of file sp-spiral.cpp.

References SPSpiral::arg, SPSpiral::cx, SPSpiral::cy, SPSpiral::exp, SPSpiral::rad, SPSpiral::revo, Inkscape::XML::Node::setAttribute(), sp_repr_set_svg_double(), and SPSpiral::t0.

Referenced by sp_spiral_class_init().

{
      SPSpiral *spiral = SP_SPIRAL (object);

      if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
                Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
            repr = xml_doc->createElement("svg:path");
      }

      if (flags & SP_OBJECT_WRITE_EXT) {
            /* Fixme: we may replace these attributes by
             * sodipodi:spiral="cx cy exp revo rad arg t0"
             */
            repr->setAttribute("sodipodi:type", "spiral");
            sp_repr_set_svg_double(repr, "sodipodi:cx", spiral->cx);
            sp_repr_set_svg_double(repr, "sodipodi:cy", spiral->cy);
            sp_repr_set_svg_double(repr, "sodipodi:expansion", spiral->exp);
            sp_repr_set_svg_double(repr, "sodipodi:revolution", spiral->revo);
            sp_repr_set_svg_double(repr, "sodipodi:radius", spiral->rad);
            sp_repr_set_svg_double(repr, "sodipodi:argument", spiral->arg);
            sp_repr_set_svg_double(repr, "sodipodi:t0", spiral->t0);
      }

     // make sure the curve is rebuilt with all up-to-date parameters
     sp_spiral_set_shape ((SPShape *) spiral);

        //Duplicate the path
        SPCurve *curve = ((SPShape *) spiral)->curve;
        //Nulls might be possible if this called iteratively
        if ( !curve ) {
                //g_warning("sp_spiral_write(): No path to copy\n");
                return NULL;
        }
        NArtBpath *bpath = SP_CURVE_BPATH(curve);
        if ( !bpath ) {
                //g_warning("sp_spiral_write(): No path to copy\n");
                return NULL;
        }
      char *d = sp_svg_write_path ( bpath );
      repr->setAttribute("d", d);
      g_free (d);

      if (((SPObjectClass *) (parent_class))->write)
            ((SPObjectClass *) (parent_class))->write (object, repr, flags | SP_SHAPE_WRITE_PATH);

      return repr;
}


Generated by  Doxygen 1.6.0   Back to index