summaryrefslogtreecommitdiffstats
path: root/src/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/export.cpp61
-rw-r--r--src/dialogs/tiledialog.cpp61
-rw-r--r--src/dialogs/unclump.cpp140
3 files changed, 130 insertions, 132 deletions
diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp
index 382e956ef..5e23f0656 100644
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
@@ -778,12 +778,12 @@ sp_export_selection_modified ( Inkscape::Application */*inkscape*/,
if ( SP_ACTIVE_DESKTOP ) {
SPDocument *doc;
doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
- boost::optional<NR::Rect> bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)));
+ boost::optional<Geom::Rect> bbox = to_2geom(sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc))));
if (bbox) {
- sp_export_set_area (base, bbox->min()[NR::X],
- bbox->min()[NR::Y],
- bbox->max()[NR::X],
- bbox->max()[NR::Y]);
+ sp_export_set_area (base, bbox->min()[Geom::X],
+ bbox->min()[Geom::Y],
+ bbox->max()[Geom::X],
+ bbox->max()[Geom::Y]);
}
}
break;
@@ -837,7 +837,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base)
if ( SP_ACTIVE_DESKTOP )
{
SPDocument *doc;
- boost::optional<NR::Rect> bbox;
+ boost::optional<Geom::Rect> bbox;
doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
/* Notice how the switch is used to 'fall through' here to get
@@ -847,7 +847,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base)
case SELECTION_SELECTION:
if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false)
{
- bbox = (sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds();
+ bbox = to_2geom((sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds());
/* Only if there is a selection that we can set
do we break, otherwise we fall through to the
drawing */
@@ -859,7 +859,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base)
/** \todo
* This returns wrong values if the document has a viewBox.
*/
- bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)));
+ bbox = to_2geom(sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc))));
/* If the drawing is valid, then we'll use it and break
otherwise we drop through to the page settings */
if (bbox) {
@@ -868,9 +868,8 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base)
break;
}
case SELECTION_PAGE:
- bbox = NR::Rect(NR::Point(0.0, 0.0),
- NR::Point(sp_document_width(doc), sp_document_height(doc))
- );
+ bbox = Geom::Rect(Geom::Point(0.0, 0.0),
+ Geom::Point(sp_document_width(doc), sp_document_height(doc)));
// std::cout << "Using selection: PAGE" << std::endl;
key = SELECTION_PAGE;
@@ -885,10 +884,10 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base)
prefs->setString("dialogs.export.exportarea", "value", selection_names[key]);
if ( key != SELECTION_CUSTOM && bbox ) {
- sp_export_set_area (base, bbox->min()[NR::X],
- bbox->min()[NR::Y],
- bbox->max()[NR::X],
- bbox->max()[NR::Y]);
+ sp_export_set_area (base, bbox->min()[Geom::X],
+ bbox->min()[Geom::Y],
+ bbox->max()[Geom::X],
+ bbox->max()[Geom::Y]);
}
} // end of if ( SP_ACTIVE_DESKTOP )
@@ -1347,14 +1346,14 @@ sp_export_browse_clicked (GtkButton */*button*/, gpointer /*userdata*/)
// TODO: Move this to nr-rect-fns.h.
static bool
-sp_export_bbox_equal(NR::Rect const &one, NR::Rect const &two)
+sp_export_bbox_equal(Geom::Rect const &one, Geom::Rect const &two)
{
double const epsilon = pow(10.0, -EXPORT_COORD_PRECISION);
return (
- (fabs(one.min()[NR::X] - two.min()[NR::X]) < epsilon) &&
- (fabs(one.min()[NR::Y] - two.min()[NR::Y]) < epsilon) &&
- (fabs(one.max()[NR::X] - two.max()[NR::X]) < epsilon) &&
- (fabs(one.max()[NR::Y] - two.max()[NR::Y]) < epsilon)
+ (fabs(one.min()[Geom::X] - two.min()[Geom::X]) < epsilon) &&
+ (fabs(one.min()[Geom::Y] - two.min()[Geom::Y]) < epsilon) &&
+ (fabs(one.max()[Geom::X] - two.max()[Geom::X]) < epsilon) &&
+ (fabs(one.max()[Geom::Y] - two.max()[Geom::Y]) < epsilon)
);
}
@@ -1387,11 +1386,11 @@ sp_export_detect_size(GtkObject * base) {
selection_type this_test[SELECTION_NUMBER_OF + 1];
selection_type key = SELECTION_NUMBER_OF;
- NR::Point x(sp_export_value_get_px (base, "x0"),
- sp_export_value_get_px (base, "y0"));
- NR::Point y(sp_export_value_get_px (base, "x1"),
- sp_export_value_get_px (base, "y1"));
- NR::Rect current_bbox(x, y);
+ Geom::Point x(sp_export_value_get_px (base, "x0"),
+ sp_export_value_get_px (base, "y0"));
+ Geom::Point y(sp_export_value_get_px (base, "x1"),
+ sp_export_value_get_px (base, "y1"));
+ Geom::Rect current_bbox(x, y);
//std::cout << "Current " << current_bbox;
this_test[0] = (selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type")));
@@ -1408,7 +1407,7 @@ sp_export_detect_size(GtkObject * base) {
switch (this_test[i]) {
case SELECTION_SELECTION:
if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) {
- boost::optional<NR::Rect> bbox = (sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds();
+ boost::optional<Geom::Rect> bbox = to_2geom((sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds());
//std::cout << "Selection " << bbox;
if ( bbox && sp_export_bbox_equal(*bbox,current_bbox)) {
@@ -1419,7 +1418,7 @@ sp_export_detect_size(GtkObject * base) {
case SELECTION_DRAWING: {
SPDocument *doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
- boost::optional<NR::Rect> bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)));
+ boost::optional<Geom::Rect> bbox = to_2geom(sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc))));
// std::cout << "Drawing " << bbox2;
if ( bbox && sp_export_bbox_equal(*bbox,current_bbox) ) {
@@ -1433,10 +1432,10 @@ sp_export_detect_size(GtkObject * base) {
doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
- NR::Point x(0.0, 0.0);
- NR::Point y(sp_document_width(doc),
- sp_document_height(doc));
- NR::Rect bbox(x, y);
+ Geom::Point x(0.0, 0.0);
+ Geom::Point y(sp_document_width(doc),
+ sp_document_height(doc));
+ Geom::Rect bbox(x, y);
// std::cout << "Page " << bbox;
if (sp_export_bbox_equal(bbox,current_bbox)) {
diff --git a/src/dialogs/tiledialog.cpp b/src/dialogs/tiledialog.cpp
index 63732df0b..e1287f051 100644
--- a/src/dialogs/tiledialog.cpp
+++ b/src/dialogs/tiledialog.cpp
@@ -23,7 +23,6 @@
#include <glibmm/i18n.h>
#include <gtkmm/stock.h>
-#include "libnr/nr-matrix-ops.h"
#include "verbs.h"
#include "prefs-utils.h"
#include "inkscape.h"
@@ -46,11 +45,11 @@
int
sp_compare_x_position(SPItem *first, SPItem *second)
{
- using NR::X;
- using NR::Y;
+ using Geom::X;
+ using Geom::Y;
- boost::optional<NR::Rect> a = first->getBounds(sp_item_i2doc_affine(first));
- boost::optional<NR::Rect> b = second->getBounds(sp_item_i2doc_affine(second));
+ boost::optional<Geom::Rect> a = to_2geom(first->getBounds(sp_item_i2doc_affine(first)));
+ boost::optional<Geom::Rect> b = to_2geom(second->getBounds(sp_item_i2doc_affine(second)));
if ( !a || !b ) {
// FIXME?
@@ -89,18 +88,18 @@ sp_compare_x_position(SPItem *first, SPItem *second)
int
sp_compare_y_position(SPItem *first, SPItem *second)
{
- boost::optional<NR::Rect> a = first->getBounds(sp_item_i2doc_affine(first));
- boost::optional<NR::Rect> b = second->getBounds(sp_item_i2doc_affine(second));
+ boost::optional<Geom::Rect> a = to_2geom(first->getBounds(sp_item_i2doc_affine(first)));
+ boost::optional<Geom::Rect> b = to_2geom(second->getBounds(sp_item_i2doc_affine(second)));
if ( !a || !b ) {
// FIXME?
return 0;
}
- if (a->min()[NR::Y] > b->min()[NR::Y]) {
+ if (a->min()[Geom::Y] > b->min()[Geom::Y]) {
return 1;
}
- if (a->min()[NR::Y] < b->min()[NR::Y]) {
+ if (a->min()[Geom::Y] < b->min()[Geom::Y]) {
return -1;
}
@@ -169,22 +168,22 @@ void TileDialog::Grid_Arrange ()
cnt=0;
for (; items != NULL; items = items->next) {
SPItem *item = SP_ITEM(items->data);
- boost::optional<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
+ boost::optional<Geom::Rect> b = to_2geom(item->getBounds(sp_item_i2doc_affine(item)));
if (!b) {
continue;
}
- width = b->dimensions()[NR::X];
- height = b->dimensions()[NR::Y];
+ width = b->dimensions()[Geom::X];
+ height = b->dimensions()[Geom::Y];
- cx = b->midpoint()[NR::X];
- cy = b->midpoint()[NR::Y];
+ cx = b->midpoint()[Geom::X];
+ cy = b->midpoint()[Geom::Y];
- if (b->min()[NR::X] < grid_left) {
- grid_left = b->min()[NR::X];
+ if (b->min()[Geom::X] < grid_left) {
+ grid_left = b->min()[Geom::X];
}
- if (b->min()[NR::Y] < grid_top) {
- grid_top = b->min()[NR::Y];
+ if (b->min()[Geom::Y] < grid_top) {
+ grid_top = b->min()[Geom::Y];
}
if (width > col_width) {
col_width = width;
@@ -211,10 +210,10 @@ void TileDialog::Grid_Arrange ()
const GSList *sizes = sorted;
for (; sizes != NULL; sizes = sizes->next) {
SPItem *item = SP_ITEM(sizes->data);
- boost::optional<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
+ boost::optional<Geom::Rect> b = to_2geom(item->getBounds(sp_item_i2doc_affine(item)));
if (b) {
- width = b->dimensions()[NR::X];
- height = b->dimensions()[NR::Y];
+ width = b->dimensions()[Geom::X];
+ height = b->dimensions()[Geom::Y];
if (width > col_widths[(cnt % NoOfCols)]) {
col_widths[(cnt % NoOfCols)] = width;
}
@@ -268,14 +267,14 @@ void TileDialog::Grid_Arrange ()
}
- boost::optional<NR::Rect> sel_bbox = selection->bounds();
+ boost::optional<Geom::Rect> sel_bbox = to_2geom(selection->bounds());
// Fit to bbox, calculate padding between rows accordingly.
if ( sel_bbox && !SpaceManualRadioButton.get_active() ){
#ifdef DEBUG_GRID_ARRANGE
-g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_height,total_col_width, b.extent(NR::X), b.extent(NR::Y));
+g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_height,total_col_width, b.extent(Geom::X), b.extent(Geom::Y));
#endif
- paddingx = (sel_bbox->extent(NR::X) - total_col_width) / (NoOfCols -1);
- paddingy = (sel_bbox->extent(NR::Y) - total_row_height) / (NoOfRows -1);
+ paddingx = (sel_bbox->width() - total_col_width) / (NoOfCols -1);
+ paddingy = (sel_bbox->height() - total_row_height) / (NoOfRows -1);
}
/*
@@ -318,15 +317,15 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
for (; current_row != NULL; current_row = current_row->next) {
SPItem *item=SP_ITEM(current_row->data);
Inkscape::XML::Node *repr = SP_OBJECT_REPR(item);
- boost::optional<NR::Rect> b = item->getBounds(sp_item_i2doc_affine(item));
- NR::Point min;
+ boost::optional<Geom::Rect> b = to_2geom(item->getBounds(sp_item_i2doc_affine(item)));
+ Geom::Point min;
if (b) {
- width = b->dimensions()[NR::X];
- height = b->dimensions()[NR::Y];
+ width = b->dimensions()[Geom::X];
+ height = b->dimensions()[Geom::Y];
min = b->min();
} else {
width = height = 0;
- min = NR::Point(0, 0);
+ min = Geom::Point(0, 0);
}
row = cnt / NoOfCols;
@@ -336,7 +335,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
new_y = grid_top + (((row_heights[row] - height)/2)*VertAlign) + row_ys[row];
// signs are inverted between x and y due to y inversion
- NR::Point move = NR::Point(new_x - min[NR::X], min[NR::Y] - new_y);
+ Geom::Point move = Geom::Point(new_x - min[Geom::X], min[Geom::Y] - new_y);
Geom::Matrix const affine = Geom::Matrix(Geom::Translate(move));
sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * affine);
sp_item_write_transform(item, repr, item->transform, NULL);
diff --git a/src/dialogs/unclump.cpp b/src/dialogs/unclump.cpp
index 77c18aa64..9e4fce1e7 100644
--- a/src/dialogs/unclump.cpp
+++ b/src/dialogs/unclump.cpp
@@ -21,45 +21,45 @@
// cache the centers, widths, and heights of items
//FIXME: make a class with these cashes as members instead of globals
-std::map<const gchar *, NR::Point> c_cache;
-std::map<const gchar *, NR::Point> wh_cache;
+std::map<const gchar *, Geom::Point> c_cache;
+std::map<const gchar *, Geom::Point> wh_cache;
/**
Center of bbox of item
*/
-NR::Point
+Geom::Point
unclump_center (SPItem *item)
{
- std::map<const gchar *, NR::Point>::iterator i = c_cache.find(SP_OBJECT_ID(item));
+ std::map<const gchar *, Geom::Point>::iterator i = c_cache.find(SP_OBJECT_ID(item));
if ( i != c_cache.end() ) {
return i->second;
}
- boost::optional<NR::Rect> r = item->getBounds(sp_item_i2d_affine(item));
+ boost::optional<Geom::Rect> r = to_2geom(item->getBounds(sp_item_i2d_affine(item)));
if (r) {
- NR::Point const c = r->midpoint();
+ Geom::Point const c = r->midpoint();
c_cache[SP_OBJECT_ID(item)] = c;
return c;
} else {
// FIXME
- return NR::Point(0, 0);
+ return Geom::Point(0, 0);
}
}
-NR::Point
+Geom::Point
unclump_wh (SPItem *item)
{
- NR::Point wh;
- std::map<const gchar *, NR::Point>::iterator i = wh_cache.find(SP_OBJECT_ID(item));
+ Geom::Point wh;
+ std::map<const gchar *, Geom::Point>::iterator i = wh_cache.find(SP_OBJECT_ID(item));
if ( i != wh_cache.end() ) {
wh = i->second;
} else {
- boost::optional<NR::Rect> r = item->getBounds(sp_item_i2d_affine(item));
+ boost::optional<Geom::Rect> r = to_2geom(item->getBounds(sp_item_i2d_affine(item)));
if (r) {
wh = r->dimensions();
wh_cache[SP_OBJECT_ID(item)] = wh;
} else {
- wh = NR::Point(0, 0);
+ wh = Geom::Point(0, 0);
}
}
@@ -74,30 +74,30 @@ May be negative if the edge of item1 is between the center and the edge of item2
double
unclump_dist (SPItem *item1, SPItem *item2)
{
- NR::Point c1 = unclump_center (item1);
- NR::Point c2 = unclump_center (item2);
+ Geom::Point c1 = unclump_center (item1);
+ Geom::Point c2 = unclump_center (item2);
- NR::Point wh1 = unclump_wh (item1);
- NR::Point wh2 = unclump_wh (item2);
+ Geom::Point wh1 = unclump_wh (item1);
+ Geom::Point wh2 = unclump_wh (item2);
// angle from each item's center to the other's, unsqueezed by its w/h, normalized to 0..pi/2
- double a1 = atan2 ((c2 - c1)[NR::Y], (c2 - c1)[NR::X] * wh1[NR::Y]/wh1[NR::X]);
+ double a1 = atan2 ((c2 - c1)[Geom::Y], (c2 - c1)[Geom::X] * wh1[Geom::Y]/wh1[Geom::X]);
a1 = fabs (a1);
if (a1 > M_PI/2) a1 = M_PI - a1;
- double a2 = atan2 ((c1 - c2)[NR::Y], (c1 - c2)[NR::X] * wh2[NR::Y]/wh2[NR::X]);
+ double a2 = atan2 ((c1 - c2)[Geom::Y], (c1 - c2)[Geom::X] * wh2[Geom::Y]/wh2[Geom::X]);
a2 = fabs (a2);
if (a2 > M_PI/2) a2 = M_PI - a2;
// get the radius of each item for the given angle
- double r1 = 0.5 * (wh1[NR::X] + (wh1[NR::Y] - wh1[NR::X]) * (a1/(M_PI/2)));
- double r2 = 0.5 * (wh2[NR::X] + (wh2[NR::Y] - wh2[NR::X]) * (a2/(M_PI/2)));
+ double r1 = 0.5 * (wh1[Geom::X] + (wh1[Geom::Y] - wh1[Geom::X]) * (a1/(M_PI/2)));
+ double r2 = 0.5 * (wh2[Geom::X] + (wh2[Geom::Y] - wh2[Geom::X]) * (a2/(M_PI/2)));
// dist between centers minus angle-adjusted radii
- double dist_r = (NR::L2 (c2 - c1) - r1 - r2);
+ double dist_r = (Geom::L2 (c2 - c1) - r1 - r2);
- double stretch1 = wh1[NR::Y]/wh1[NR::X];
- double stretch2 = wh2[NR::Y]/wh2[NR::X];
+ double stretch1 = wh1[Geom::Y]/wh1[Geom::X];
+ double stretch2 = wh2[Geom::Y]/wh2[Geom::X];
if ((stretch1 > 1.5 || stretch1 < 0.66) && (stretch2 > 1.5 || stretch2 < 0.66)) {
@@ -105,54 +105,54 @@ unclump_dist (SPItem *item1, SPItem *item2)
dists.push_back (dist_r);
// If both objects are not circle-like, find dists between four corners
- std::vector<NR::Point> c1_points(2);
+ std::vector<Geom::Point> c1_points(2);
{
double y_closest;
- if (c2[NR::Y] > c1[NR::Y] + wh1[NR::Y]/2) {
- y_closest = c1[NR::Y] + wh1[NR::Y]/2;
- } else if (c2[NR::Y] < c1[NR::Y] - wh1[NR::Y]/2) {
- y_closest = c1[NR::Y] - wh1[NR::Y]/2;
+ if (c2[Geom::Y] > c1[Geom::Y] + wh1[Geom::Y]/2) {
+ y_closest = c1[Geom::Y] + wh1[Geom::Y]/2;
+ } else if (c2[Geom::Y] < c1[Geom::Y] - wh1[Geom::Y]/2) {
+ y_closest = c1[Geom::Y] - wh1[Geom::Y]/2;
} else {
- y_closest = c2[NR::Y];
+ y_closest = c2[Geom::Y];
}
- c1_points[0] = NR::Point (c1[NR::X], y_closest);
+ c1_points[0] = Geom::Point (c1[Geom::X], y_closest);
double x_closest;
- if (c2[NR::X] > c1[NR::X] + wh1[NR::X]/2) {
- x_closest = c1[NR::X] + wh1[NR::X]/2;
- } else if (c2[NR::X] < c1[NR::X] - wh1[NR::X]/2) {
- x_closest = c1[NR::X] - wh1[NR::X]/2;
+ if (c2[Geom::X] > c1[Geom::X] + wh1[Geom::X]/2) {
+ x_closest = c1[Geom::X] + wh1[Geom::X]/2;
+ } else if (c2[Geom::X] < c1[Geom::X] - wh1[Geom::X]/2) {
+ x_closest = c1[Geom::X] - wh1[Geom::X]/2;
} else {
- x_closest = c2[NR::X];
+ x_closest = c2[Geom::X];
}
- c1_points[1] = NR::Point (x_closest, c1[NR::Y]);
+ c1_points[1] = Geom::Point (x_closest, c1[Geom::Y]);
}
- std::vector<NR::Point> c2_points(2);
+ std::vector<Geom::Point> c2_points(2);
{
double y_closest;
- if (c1[NR::Y] > c2[NR::Y] + wh2[NR::Y]/2) {
- y_closest = c2[NR::Y] + wh2[NR::Y]/2;
- } else if (c1[NR::Y] < c2[NR::Y] - wh2[NR::Y]/2) {
- y_closest = c2[NR::Y] - wh2[NR::Y]/2;
+ if (c1[Geom::Y] > c2[Geom::Y] + wh2[Geom::Y]/2) {
+ y_closest = c2[Geom::Y] + wh2[Geom::Y]/2;
+ } else if (c1[Geom::Y] < c2[Geom::Y] - wh2[Geom::Y]/2) {
+ y_closest = c2[Geom::Y] - wh2[Geom::Y]/2;
} else {
- y_closest = c1[NR::Y];
+ y_closest = c1[Geom::Y];
}
- c2_points[0] = NR::Point (c2[NR::X], y_closest);
+ c2_points[0] = Geom::Point (c2[Geom::X], y_closest);
double x_closest;
- if (c1[NR::X] > c2[NR::X] + wh2[NR::X]/2) {
- x_closest = c2[NR::X] + wh2[NR::X]/2;
- } else if (c1[NR::X] < c2[NR::X] - wh2[NR::X]/2) {
- x_closest = c2[NR::X] - wh2[NR::X]/2;
+ if (c1[Geom::X] > c2[Geom::X] + wh2[Geom::X]/2) {
+ x_closest = c2[Geom::X] + wh2[Geom::X]/2;
+ } else if (c1[Geom::X] < c2[Geom::X] - wh2[Geom::X]/2) {
+ x_closest = c2[Geom::X] - wh2[Geom::X]/2;
} else {
- x_closest = c1[NR::X];
+ x_closest = c1[Geom::X];
}
- c2_points[1] = NR::Point (x_closest, c2[NR::Y]);
+ c2_points[1] = Geom::Point (x_closest, c2[Geom::Y]);
}
for (int i = 0; i < 2; i ++) {
for (int j = 0; j < 2; j ++) {
- dists.push_back (NR::L2 (c1_points[i] - c2_points[j]));
+ dists.push_back (Geom::L2 (c1_points[i] - c2_points[j]));
}
}
@@ -243,20 +243,20 @@ item to \a closest. Returns a newly created list which must be freed.
GSList *
unclump_remove_behind (SPItem *item, SPItem *closest, GSList *rest)
{
- NR::Point it = unclump_center (item);
- NR::Point p1 = unclump_center (closest);
+ Geom::Point it = unclump_center (item);
+ Geom::Point p1 = unclump_center (closest);
// perpendicular through closest to the direction to item:
- NR::Point perp = NR::rot90(it - p1);
- NR::Point p2 = p1 + perp;
+ Geom::Point perp = Geom::rot90(it - p1);
+ Geom::Point p2 = p1 + perp;
// get the standard Ax + By + C = 0 form for p1-p2:
- double A = p1[NR::Y] - p2[NR::Y];
- double B = p2[NR::X] - p1[NR::X];
- double C = p2[NR::Y] * p1[NR::X] - p1[NR::Y] * p2[NR::X];
+ double A = p1[Geom::Y] - p2[Geom::Y];
+ double B = p2[Geom::X] - p1[Geom::X];
+ double C = p2[Geom::Y] * p1[Geom::X] - p1[Geom::Y] * p2[Geom::X];
// substitute the item into it:
- double val_item = A * it[NR::X] + B * it[NR::Y] + C;
+ double val_item = A * it[Geom::X] + B * it[Geom::Y] + C;
GSList *out = NULL;
@@ -266,8 +266,8 @@ unclump_remove_behind (SPItem *item, SPItem *closest, GSList *rest)
if (other == item)
continue;
- NR::Point o = unclump_center (other);
- double val_other = A * o[NR::X] + B * o[NR::Y] + C;
+ Geom::Point o = unclump_center (other);
+ double val_other = A * o[Geom::X] + B * o[Geom::Y] + C;
if (val_item * val_other <= 1e-6) {
// different signs, which means item and other are on the different sides of p1-p2 line; skip
@@ -285,18 +285,18 @@ Moves \a what away from \a from by \a dist
void
unclump_push (SPItem *from, SPItem *what, double dist)
{
- NR::Point it = unclump_center (what);
- NR::Point p = unclump_center (from);
- NR::Point by = dist * NR::unit_vector (- (p - it));
+ Geom::Point it = unclump_center (what);
+ Geom::Point p = unclump_center (from);
+ Geom::Point by = dist * Geom::unit_vector (- (p - it));
Geom::Matrix move = Geom::Translate (by);
- std::map<const gchar *, NR::Point>::iterator i = c_cache.find(SP_OBJECT_ID(what));
+ std::map<const gchar *, Geom::Point>::iterator i = c_cache.find(SP_OBJECT_ID(what));
if ( i != c_cache.end() ) {
i->second *= move;
}
- //g_print ("push %s at %g,%g from %g,%g by %g,%g, dist %g\n", SP_OBJECT_ID(what), it[NR::X],it[NR::Y], p[NR::X],p[NR::Y], by[NR::X],by[NR::Y], dist);
+ //g_print ("push %s at %g,%g from %g,%g by %g,%g, dist %g\n", SP_OBJECT_ID(what), it[Geom::X],it[Geom::Y], p[Geom::X],p[Geom::Y], by[Geom::X],by[Geom::Y], dist);
sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * move);
sp_item_write_transform(what, SP_OBJECT_REPR(what), what->transform, NULL);
@@ -308,18 +308,18 @@ Moves \a what towards \a to by \a dist
void
unclump_pull (SPItem *to, SPItem *what, double dist)
{
- NR::Point it = unclump_center (what);
- NR::Point p = unclump_center (to);
- NR::Point by = dist * NR::unit_vector (p - it);
+ Geom::Point it = unclump_center (what);
+ Geom::Point p = unclump_center (to);
+ Geom::Point by = dist * Geom::unit_vector (p - it);
Geom::Matrix move = Geom::Translate (by);
- std::map<const gchar *, NR::Point>::iterator i = c_cache.find(SP_OBJECT_ID(what));
+ std::map<const gchar *, Geom::Point>::iterator i = c_cache.find(SP_OBJECT_ID(what));
if ( i != c_cache.end() ) {
i->second *= move;
}
- //g_print ("pull %s at %g,%g to %g,%g by %g,%g, dist %g\n", SP_OBJECT_ID(what), it[NR::X],it[NR::Y], p[NR::X],p[NR::Y], by[NR::X],by[NR::Y], dist);
+ //g_print ("pull %s at %g,%g to %g,%g by %g,%g, dist %g\n", SP_OBJECT_ID(what), it[Geom::X],it[Geom::Y], p[Geom::X],p[Geom::Y], by[Geom::X],by[Geom::Y], dist);
sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * move);
sp_item_write_transform(what, SP_OBJECT_REPR(what), what->transform, NULL);