Ignore:
Timestamp:
Jun 17, 2013, 1:48:27 AM (11 years ago)
Author:
ldelgass
Message:

Use imroved Arc API (arc can only represent a circular section, and setting
two endpoints could cause problems with endpts and center colinear and radii
from center to two endpoints differing). New API uses a center, start point,
normal and sweep angle. Also change Line to support polylines: protocol is
changed to require a Tcl list for point coordinates instead of a fixed 2
endpoints.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/RendererGraphicsObjs.cpp

    r3695 r3696  
    88#include <cstring>
    99#include <typeinfo>
     10#include <vector>
    1011
    1112#include <vtkVersion.h>
     
    394395 * \brief Create a new Arc and associate it with an ID
    395396 */
    396 bool Renderer::addArc(const DataSetId& id, double center[3],
    397                       double pt1[3], double pt2[3])
     397bool Renderer::addArc(const DataSetId& id,
     398                      double center[3],
     399                      double pt1[3],
     400                      double normal[3],
     401                      double angle)
    398402{
    399403    Arc *gobj;
     
    419423
    420424    gobj->setCenter(center);
    421     gobj->setEndPoints(pt1, pt2);
     425    gobj->setStartPoint(pt1);
     426    gobj->setNormal(normal);
     427    gobj->setAngle(angle);
    422428
    423429    getGraphicsObjectHashmap<Arc>()[id] = gobj;
     
    22992305
    23002306/**
     2307 * \brief Create a new Line and associate it with an ID
     2308 */
     2309bool Renderer::addLine(const DataSetId& id, std::vector<double> points)
     2310{
     2311    Line *gobj;
     2312    if ((gobj = getGraphicsObject<Line>(id)) != NULL) {
     2313        WARN("Replacing existing %s %s", gobj->getClassName(), id.c_str());
     2314        deleteGraphicsObject<Line>(id);
     2315    }
     2316
     2317    gobj = new Line();
     2318 
     2319    gobj->setDataSet(NULL, this);
     2320
     2321    if (gobj->getProp() == NULL &&
     2322        gobj->getOverlayProp() == NULL) {
     2323        delete gobj;
     2324        return false;
     2325    } else {
     2326        if (gobj->getProp())
     2327            _renderer->AddViewProp(gobj->getProp());
     2328        if (gobj->getOverlayProp())
     2329            _renderer->AddViewProp(gobj->getOverlayProp());
     2330    }
     2331
     2332    gobj->setPoints(points);
     2333
     2334    getGraphicsObjectHashmap<Line>()[id] = gobj;
     2335
     2336    sceneBoundsChanged();
     2337    _needsRedraw = true;
     2338    return true;
     2339}
     2340
     2341/**
    23012342 * \brief Set atom sphere resolution
    23022343 */
Note: See TracChangeset for help on using the changeset viewer.