diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-04-09 19:30:28 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-04-09 19:30:28 +0000 |
| commit | cec061f7cf7b30d2a92ddf729c36aa032a1b6ddf (patch) | |
| tree | 7ae200dd34ca0c610ddc40e262ceae9282a02f72 /src | |
| parent | astyle simplify LPE (diff) | |
| download | inkscape-cec061f7cf7b30d2a92ddf729c36aa032a1b6ddf.tar.gz inkscape-cec061f7cf7b30d2a92ddf729c36aa032a1b6ddf.zip | |
Coding style fixes
(bzr r13973.1.13)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-simplify.cpp | 80 | ||||
| -rw-r--r-- | src/live_effects/lpe-simplify.h | 6 |
2 files changed, 43 insertions, 43 deletions
diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index bbedd355a..d2ced47ae 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -31,17 +31,17 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.003), smooth_angles(_("Smooth angles:"), _("Max degree difference on handles to preform a smooth"), "smooth_angles", &wr, this, 20.), helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 5), - simplifyindividualpaths(_("Paths separately"), _("Simplifying paths (separately)"), "simplifyindividualpaths", &wr, this, false, + simplify_individual_paths(_("Paths separately"), _("Simplifying paths (separately)"), "simplify_individual_paths", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), - simplifyJustCoalesce(_("Just coalesce"), _("Simplify just coalesce"), "simplifyJustCoalesce", &wr, this, false, + simplify_just_coalesce(_("Just coalesce"), _("Simplify just coalesce"), "simplify_just_coalesce", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")) { registerParameter(&steps); registerParameter(&threshold); registerParameter(&smooth_angles); registerParameter(&helper_size); - registerParameter(&simplifyindividualpaths); - registerParameter(&simplifyJustCoalesce); + registerParameter(&simplify_individual_paths); + registerParameter(&simplify_just_coalesce); threshold.param_set_range(0.0001, Geom::infinity()); threshold.param_set_increments(0.0001, 0.0001); @@ -59,7 +59,7 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) helper_size.param_set_increments(5, 5); helper_size.param_set_digits(2); - radiusHelperNodes = 6.0; + radius_helper_nodes = 6.0; } LPESimplify::~LPESimplify() {} @@ -72,7 +72,7 @@ LPESimplify::doBeforeEffect (SPLPEItem const* lpeitem) } bbox = SP_ITEM(lpeitem)->visualBounds(); SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem); - radiusHelperNodes = helper_size; + radius_helper_nodes = helper_size; item->apply_to_clippath(item); item->apply_to_mask(item); } @@ -91,8 +91,8 @@ LPESimplify::newWidget() if ((*it)->widget_is_visible) { Parameter * param = *it; Gtk::Widget * widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget()); - if (param->param_key == "simplifyindividualpaths" || - param->param_key == "simplifyJustCoalesce") { + if (param->param_key == "simplify_individual_paths" || + param->param_key == "simplify_just_coalesce") { Glib::ustring * tip = param->param_getTooltip(); if (widg) { buttons->pack_start(*widg, true, true, 2); @@ -106,10 +106,10 @@ LPESimplify::newWidget() } else { Glib::ustring * tip = param->param_getTooltip(); if (widg) { - Gtk::HBox * scalarParameter = dynamic_cast<Gtk::HBox *>(widg); - std::vector< Gtk::Widget* > childList = scalarParameter->get_children(); - Gtk::Entry* entryWidg = dynamic_cast<Gtk::Entry *>(childList[1]); - entryWidg->set_width_chars(8); + Gtk::HBox * horizontal_box = dynamic_cast<Gtk::HBox *>(widg); + std::vector< Gtk::Widget* > child_list = horizontal_box->get_children(); + Gtk::Entry* entry_widg = dynamic_cast<Gtk::Entry *>(child_list[1]); + entry_widg->set_width_chars(8); vbox->pack_start(*widg, true, true, 2); if (tip) { widg->set_tooltip_text(*tip); @@ -134,11 +134,11 @@ LPESimplify::doEffect(SPCurve *curve) gdouble size = Geom::L2(bbox->dimensions()); //size /= Geom::Affine(0,0,0,0,0,0).descrim(); Path* pathliv = Path_for_pathvector(original_pathv); - if(simplifyindividualpaths) { + if(simplify_individual_paths) { size = Geom::L2(Geom::bounds_fast(original_pathv)->dimensions()); } for (int unsigned i = 0; i < steps; i++) { - if ( simplifyJustCoalesce ) { + if ( simplify_just_coalesce ) { pathliv->Coalesce(threshold * size); } else { pathliv->ConvertEvenLines(threshold * size); @@ -161,7 +161,7 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) if(steps < 1) { return; } - Geom::PathVector tmpPath; + Geom::PathVector tmp_path; Geom::CubicBezier const *cubic = NULL; for (Geom::PathVector::iterator path_it = result.begin(); path_it != result.end(); ++path_it) { //Si está vacío... @@ -188,48 +188,48 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) } } if(helper_size > 0) { - drawNode(curve_it1->initialPoint()); + draw_node(curve_it1->initialPoint()); } nCurve->moveto(curve_it1->initialPoint()); Geom::Point start = Geom::Point(0,0); while (curve_it1 != curve_endit) { cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1); - Geom::Point pointAt1 = curve_it1->initialPoint(); - Geom::Point pointAt2 = curve_it1->finalPoint(); - Geom::Point pointAt3 = curve_it1->finalPoint(); - Geom::Point pointAt4 = curve_it1->finalPoint(); + Geom::Point point_at1 = curve_it1->initialPoint(); + Geom::Point point_at2 = curve_it1->finalPoint(); + Geom::Point point_at3 = curve_it1->finalPoint(); + Geom::Point point_at4 = curve_it1->finalPoint(); if (cubic) { - pointAt1 = (*cubic)[1]; - pointAt2 = (*cubic)[2]; + point_at1 = (*cubic)[1]; + point_at2 = (*cubic)[2]; } if(start == Geom::Point(0,0)) { - start = pointAt1; + start = point_at1; } if(path_it->closed() && curve_it2 == curve_endit) { - pointAt4 = start; + point_at4 = start; } if(curve_it2 != curve_endit) { cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it2); if (cubic) { - pointAt4 = (*cubic)[1]; + point_at4 = (*cubic)[1]; } } - Geom::Ray ray1(pointAt2, pointAt3); - Geom::Ray ray2(pointAt3, pointAt4); + Geom::Ray ray1(point_at2, point_at3); + Geom::Ray ray2(point_at3, point_at4); double angle1 = Geom::rad_to_deg(ray1.angle()); double angle2 = Geom::rad_to_deg(ray2.angle()); - if((smooth_angles >= angle2 - angle1) && !are_near(pointAt4,pointAt3) && !are_near(pointAt2,pointAt3)) { - double dist = Geom::distance(pointAt2,pointAt3); + if((smooth_angles >= angle2 - angle1) && !are_near(point_at4,point_at3) && !are_near(point_at2,point_at3)) { + double dist = Geom::distance(point_at2,point_at3); Geom::Angle angleFixed = ray2.angle(); angleFixed -= Geom::Angle::from_degrees(180.0); - pointAt2 = Geom::Point::polar(angleFixed,dist) + pointAt3; + point_at2 = Geom::Point::polar(angleFixed,dist) + point_at3; } - nCurve->curveto(pointAt1, pointAt2, curve_it1->finalPoint()); + nCurve->curveto(point_at1, point_at2, curve_it1->finalPoint()); cubic = dynamic_cast<Geom::CubicBezier const *>(nCurve->last_segment()); if (cubic) { - pointAt1 = (*cubic)[1]; - pointAt2 = (*cubic)[2]; + point_at1 = (*cubic)[1]; + point_at2 = (*cubic)[2]; if(helper_size > 0) { if(!are_near((*cubic)[0],(*cubic)[1])) { drawHandle((*cubic)[1]); @@ -242,7 +242,7 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) } } if(helper_size > 0) { - drawNode(curve_it1->finalPoint()); + draw_node(curve_it1->finalPoint()); } ++curve_it1; ++curve_it2; @@ -250,17 +250,17 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result) if (path_it->closed()) { nCurve->closepath_current(); } - tmpPath.push_back(nCurve->get_pathvector()[0]); + tmp_path.push_back(nCurve->get_pathvector()[0]); nCurve->reset(); delete nCurve; } - result = tmpPath; + result = tmp_path; } void -LPESimplify::drawNode(Geom::Point p) +LPESimplify::draw_node(Geom::Point p) { - double r = radiusHelperNodes; + double r = radius_helper_nodes; char const * svgd; svgd = "M 0.55,0.5 A 0.05,0.05 0 0 1 0.5,0.55 0.05,0.05 0 0 1 0.45,0.5 0.05,0.05 0 0 1 0.5,0.45 0.05,0.05 0 0 1 0.55,0.5 Z M 0,0 1,0 1,1 0,1 Z"; Geom::PathVector pathv = sp_svg_read_pathv(svgd); @@ -273,7 +273,7 @@ LPESimplify::drawNode(Geom::Point p) void LPESimplify::drawHandle(Geom::Point p) { - double r = radiusHelperNodes; + double r = radius_helper_nodes; char const * svgd; svgd = "M 0.7,0.35 A 0.35,0.35 0 0 1 0.35,0.7 0.35,0.35 0 0 1 0,0.35 0.35,0.35 0 0 1 0.35,0 0.35,0.35 0 0 1 0.7,0.35 Z"; Geom::PathVector pathv = sp_svg_read_pathv(svgd); @@ -288,7 +288,7 @@ LPESimplify::drawHandleLine(Geom::Point p,Geom::Point p2) { Geom::Path path; path.start( p ); - double diameter = radiusHelperNodes; + double diameter = radius_helper_nodes; if(helper_size > 0 && Geom::distance(p,p2) > (diameter * 0.35)) { Geom::Ray ray2(p, p2); p2 = p2 - Geom::Point::polar(ray2.angle(),(diameter * 0.35)); diff --git a/src/live_effects/lpe-simplify.h b/src/live_effects/lpe-simplify.h index bc70e9f54..294d77b35 100644 --- a/src/live_effects/lpe-simplify.h +++ b/src/live_effects/lpe-simplify.h @@ -42,10 +42,10 @@ private: ScalarParam threshold; ScalarParam smooth_angles; ScalarParam helper_size; - ToggleButtonParam simplifyindividualpaths; - ToggleButtonParam simplifyJustCoalesce; + ToggleButtonParam simplify_individual_paths; + ToggleButtonParam simplify_just_coalesce; - double radiusHelperNodes; + double radius_helper_nodes; Geom::PathVector hp; Geom::OptRect bbox; |
