summaryrefslogtreecommitdiffstats
path: root/src/helper/geom-nodesatellite.h
blob: 1bb6c540e99dc7104733f660a47f1d9cfe6c8464 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// SPDX-License-Identifier: GPL-2.0-or-later
/** @file
 * NodeSatellite -- a per node holder of data.
 *//*
 * Authors:
 * see git history
 * Jabier Arraiza Cenoz<jabier.arraiza@marker.es>
 *
 * Copyright (C) 2017 Authors
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 */

#ifndef SEEN_SATELLITE_H
#define SEEN_SATELLITE_H

#include <map>
#include <boost/assign.hpp>
#include <2geom/sbasis-geometric.h>
#include "util/enums.h"

enum NodeSatelliteType
{
    FILLET = 0,       // Fillet
    INVERSE_FILLET,   // Inverse Fillet
    CHAMFER,          // Chamfer
    INVERSE_CHAMFER,  // Inverse Chamfer
    INVALID_SATELLITE // Invalid NodeSatellite
};
/**
 * @brief NodeSatellite a per node holder of data.
 */

class NodeSatellite
{
public:
    NodeSatellite();
    NodeSatellite(NodeSatelliteType nodesatellite_type);

    virtual ~NodeSatellite();
    void setIsTime(bool set_is_time)
    {
        is_time = set_is_time;
    }
    void setSelected(bool set_selected)
    {
        selected = set_selected;
    }
    void setHasMirror(bool set_has_mirror)
    {
        has_mirror = set_has_mirror;
    }
    void setHidden(bool set_hidden)
    {
        hidden = set_hidden;
    }
    void setAmount(double set_amount)
    {
        amount = set_amount;
    }
    void setAngle(double set_angle)
    {
        angle = set_angle;
    }
    void setSteps(size_t set_steps)
    {
        steps = set_steps;
    }
    double lenToRad(double const A, Geom::Curve const &curve_in, Geom::Curve const &curve_out,
                    NodeSatellite const previousNodeSatellite) const;
    double radToLen(double const A, Geom::Curve const &curve_in,
                    Geom::Curve const &curve_out) const;

    double time(Geom::Curve const &curve_in, bool inverse = false) const;
    double time(double A, bool inverse, Geom::Curve const &curve_in) const;
    double arcDistance(Geom::Curve const &curve_in) const;

    void setPosition(Geom::Point const p, Geom::Curve const &curve_in, bool inverse = false);
    Geom::Point getPosition(Geom::Curve const &curve_in, bool inverse = false) const;

    void setNodeSatellitesType(gchar const *A);
    gchar const *getNodeSatellitesTypeGchar() const;
    NodeSatelliteType nodesatellite_type;
    // The value stored could be a time value of the nodesatellite in the curve or a length of distance to the node from
    // the nodesatellite "is_time" tells us if it's a time or length value
    bool is_time;
    bool selected;
    bool has_mirror;
    bool hidden;
    // in "amount" we store the time or distance used in the nodesatellite
    double amount;
    double angle;
    size_t steps;
};

double timeAtArcLength(double const A, Geom::Curve const &curve_in);
double arcLengthAt(double const A, Geom::Curve const &curve_in);

#endif // SEEN_SATELLITE_H

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :