本文整理汇总了Java中geometry.planar.FloatPoint.round方法的典型用法代码示例。如果您正苦于以下问题:Java FloatPoint.round方法的具体用法?Java FloatPoint.round怎么用?Java FloatPoint.round使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geometry.planar.FloatPoint
的用法示例。
在下文中一共展示了FloatPoint.round方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MakeSpaceState
import geometry.planar.FloatPoint; //导入方法依赖的package包/类
/** Creates a new instance of MakeSpaceState */
public MakeSpaceState(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
{
super(p_location, p_parent_state, p_board_handling, p_logfile);
int [] shove_trace_width_arr = new int[hdlg.get_routing_board().get_layer_count()];
boolean [] layer_active_arr = new boolean[shove_trace_width_arr.length];
int shove_trace_width = Math.min (100, hdlg.get_routing_board().get_min_trace_half_width() / 10);
shove_trace_width = Math.max (shove_trace_width, 5);
for (int i = 0; i < shove_trace_width_arr.length; ++i)
{
shove_trace_width_arr[i] = shove_trace_width;
layer_active_arr[i] = true;
}
int [] route_net_no_arr = new int[1];
route_net_no_arr[0] = rules.Nets.hidden_net_no;
route = new Route(p_location.round(), hdlg.settings.layer, shove_trace_width_arr, layer_active_arr,
route_net_no_arr, 0, rules.ViaRule.EMPTY, true, hdlg.settings.trace_pull_tight_region_width,
hdlg.settings.trace_pull_tight_accuracy, null, null, hdlg.get_routing_board(),
false, false, false, hdlg.settings.hilight_routing_obstacle);
}
示例2: pick_items
import geometry.planar.FloatPoint; //导入方法依赖的package包/类
/**
* Gets all items at p_location on the active board layer with the inputt item filter.
* If nothing is found on the active layer and settings.select_on_all_layers
* is true, all layers are selected.
*/
java.util.Set<Item> pick_items(FloatPoint p_location, ItemSelectionFilter p_item_filter)
{
IntPoint location = p_location.round();
java.util.Set<Item> result = board.pick_items(location, settings.layer, p_item_filter);
if (result.size() == 0 && settings.select_on_all_visible_layers)
{
for (int i = 0; i < graphics_context.layer_count(); ++i)
{
if (i == settings.layer || graphics_context.get_layer_visibility(i) <= 0)
{
continue;
}
result.addAll(board.pick_items(location, i, p_item_filter));
}
}
return result;
}
示例3: change_position
import geometry.planar.FloatPoint; //导入方法依赖的package包/类
/**
* Changes the position for inserting the copied items to p_new_location.
*/
private void change_position(FloatPoint p_new_position)
{
current_position = p_new_position.round();
if (!current_position.equals(previous_position))
{
Vector translate_vector = current_position.difference_by(previous_position);
Iterator<board.Item> it = item_list.iterator();
while (it.hasNext())
{
board.Item curr_item = it.next();
curr_item.translate_by(translate_vector);
}
previous_position = current_position;
hdlg.repaint();
}
}
示例4: rotate_approx
import geometry.planar.FloatPoint; //导入方法依赖的package包/类
public void rotate_approx(double p_angle_in_degree, FloatPoint p_pole)
{
if (center != null)
{
FloatPoint new_center = center.to_float().rotate(Math.toRadians(p_angle_in_degree), p_pole);
this.center = new_center.round();
}
this.clear_derived_data();
}
示例5: calc_check_chape_for_from_side
import geometry.planar.FloatPoint; //导入方法依赖的package包/类
private static TileShape calc_check_chape_for_from_side(TileShape p_shape,
Point p_shape_center, Line p_border_line)
{
FloatPoint shape_center = p_shape_center.to_float();
FloatPoint offset_projection = shape_center.projection_approx(p_border_line);
// Make shure, that direction restrictions are retained.
Line [] line_arr = new Line[3];
Direction curr_dir = p_border_line.direction();
line_arr[0] = new Line(p_shape_center, curr_dir);
line_arr[1] = new Line(p_shape_center, curr_dir.turn_45_degree(2));
line_arr[2] = new Line(offset_projection.round(), curr_dir);
Polyline check_line = new Polyline(line_arr);
return check_line.offset_shape(1, 0);
}
示例6: transform_to_board
import geometry.planar.FloatPoint; //导入方法依赖的package包/类
public geometry.planar.Shape transform_to_board(CoordinateTransform p_coordinate_transform)
{
double [] curr_point = new double [2];
curr_point[0] = Math.min(coor[0], coor[2]);
curr_point[1] = Math.min(coor[1], coor[3]);
FloatPoint lower_left = p_coordinate_transform.dsn_to_board(curr_point);
curr_point[0] = Math.max(coor[0], coor[2]);
curr_point[1] = Math.max(coor[1], coor[3]);
FloatPoint upper_right= p_coordinate_transform.dsn_to_board(curr_point);
return new IntBox(lower_left.round(), upper_right.round());
}
示例7: move
import geometry.planar.FloatPoint; //导入方法依赖的package包/类
/**
* Changes the position of the items in the list to p_new_location.
*/
private void move(FloatPoint p_new_position)
{
current_position = p_new_position.round();
if (!current_position.equals(previous_position))
{
Vector translate_vector = current_position.difference_by(previous_position);
if (this.grid_snap_component != null)
{
translate_vector = adjust_to_placement_grid(translate_vector);
}
board.Components components = hdlg.get_routing_board().components;
for (Component curr_component : this.component_list)
{
components.move(curr_component.no, translate_vector);
}
this.clearance_violations = new java.util.LinkedList<ClearanceViolation>();
for (Item curr_item : this.item_list)
{
curr_item.translate_by(translate_vector);
this.clearance_violations.addAll(curr_item.clearance_violations());
}
previous_position = current_position;
for (NetItems curr_net_items : this.net_items_list)
{
this.hdlg.update_ratsnest(curr_net_items.net_no, curr_net_items.items);
}
hdlg.repaint();
}
}
示例8: CopyItemState
import geometry.planar.FloatPoint; //导入方法依赖的package包/类
/** Creates a new instance of CopyItemState */
private CopyItemState(FloatPoint p_location, Collection<Item> p_item_list,
InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
{
super(p_parent_state, p_board_handling, p_logfile);
item_list = new LinkedList<Item>();
start_position = p_location.round();
current_layer = p_board_handling.settings.layer;
layer_changed = false;
current_position = start_position;
previous_position = current_position;
Iterator<Item> it = p_item_list.iterator();
while (it.hasNext())
{
Item curr_item = it.next();
if (curr_item instanceof DrillItem || curr_item instanceof ObstacleArea)
{
Item new_item = curr_item.copy(0);
item_list.add(new_item);
}
}
if (logfile != null)
{
logfile.start_scope(LogfileScope.COPYING_ITEMS, p_location);
}
}
示例9: start_ok
import geometry.planar.FloatPoint; //导入方法依赖的package包/类
/**
* Looks for an obstacle area to modify
* Returns false, if it cannot find one.
*/
private boolean start_ok(FloatPoint p_location)
{
IntPoint pick_location = p_location.round();
ItemSelectionFilter.SelectableChoices[] selectable_choices =
{ ItemSelectionFilter.SelectableChoices.KEEPOUT,
ItemSelectionFilter.SelectableChoices.VIA_KEEPOUT,
ItemSelectionFilter.SelectableChoices.CONDUCTION
};
ItemSelectionFilter selection_filter = new ItemSelectionFilter(selectable_choices);
java.util.Collection<board.Item> found_items = hdlg.get_routing_board().pick_items(pick_location,
hdlg.settings.layer, selection_filter);
if (found_items.size() != 1)
{
hdlg.screen_messages.set_status_message(resources.getString("no_item_found_for_adding_hole"));
return false;
}
board.Item found_item = found_items.iterator().next();
if (!(found_item instanceof ObstacleArea))
{
hdlg.screen_messages.set_status_message(resources.getString("no_obstacle_area_found_for_adding_hole"));
return false;
}
this.item_to_modify = (ObstacleArea)found_item;
if (item_to_modify.get_area() instanceof Circle)
{
hdlg.screen_messages.set_status_message(resources.getString("adding_hole_to_circle_not_yet_implemented"));
return false;
}
if (this.logfile != null)
{
logfile.start_scope(LogfileScope.ADDING_HOLE);
}
this.add_corner(p_location);
return true;
}
示例10: reposition_via
import geometry.planar.FloatPoint; //导入方法依赖的package包/类
/**
* Tries to move the via into the direction of p_to_location as far as possible
* Return the new location of the via, or null, if no move was possible.
*/
private static Point reposition_via(RoutingBoard p_board, Via p_via,
IntPoint p_to_location, int p_trace_half_width, int p_trace_layer, int p_trace_cl_class)
{
Point from_location = p_via.get_center();
if (from_location.equals(p_to_location))
{
return null;
}
double ok_length = p_board.check_trace_segment(from_location, p_to_location, p_trace_layer, p_via.net_no_arr,
p_trace_half_width, p_trace_cl_class, false);
if (ok_length <= 0)
{
return null;
}
FloatPoint float_from_location = from_location.to_float();
FloatPoint float_to_location = p_to_location.to_float();
FloatPoint new_float_to_location;
if (ok_length >= Integer.MAX_VALUE)
{
new_float_to_location = float_to_location;
}
else
{
new_float_to_location = float_from_location.change_length(float_to_location, ok_length);
}
Point new_to_location = new_float_to_location.round();
Vector delta = new_to_location.difference_by(from_location);
boolean check_ok =
MoveDrillItemAlgo.check(p_via, delta, 0, 0, null, p_board, null);
if (check_ok)
{
return new_to_location;
}
final double c_min_length = 0.3 * p_trace_half_width + 1;
ok_length = Math.min(ok_length, float_from_location.distance(float_to_location));
double curr_length = ok_length / 2;
ok_length = 0;
Point result = null;
while (curr_length >= c_min_length)
{
Point check_point = float_from_location.change_length(float_to_location, ok_length + curr_length).round();
delta = check_point.difference_by(from_location);
if (MoveDrillItemAlgo.check(p_via, delta, 0, 0, null, p_board, null))
{
ok_length += curr_length;
result = check_point;
}
curr_length /= 2;
}
return result;
}
示例11: expand_to_target_doors
import geometry.planar.FloatPoint; //导入方法依赖的package包/类
/** Expand the target doors of the room. Returns true, if at leat 1 target door was expanded */
private boolean expand_to_target_doors(MazeListElement p_list_element,
boolean p_next_room_is_thick, boolean p_curr_door_is_small, FloatPoint p_shape_entry_middle)
{
if (p_curr_door_is_small)
{
boolean enter_through_small_door = false;
if (p_list_element.door instanceof ExpansionDoor)
{
CompleteExpansionRoom from_room = ((ExpansionDoor) p_list_element.door).other_room(p_list_element.next_room);
if (from_room instanceof ObstacleExpansionRoom)
{
// otherwise entering through the small door may fail, because it was not checked.
enter_through_small_door = true;
}
}
if (!enter_through_small_door)
{
return false;
}
}
boolean result = false;
for (TargetItemExpansionDoor to_door : p_list_element.next_room.get_target_doors())
{
if (to_door == p_list_element.door)
{
continue;
}
TileShape target_shape = ((Connectable) to_door.item).get_trace_connection_shape(this.autoroute_engine.autoroute_search_tree,
to_door.tree_entry_no);
FloatPoint connection_point = target_shape.nearest_point_approx(p_shape_entry_middle);
if (!p_next_room_is_thick)
{
// check the line from p_shape_entry_middle to the nearest point.
int[] curr_net_no_arr = new int[1];
curr_net_no_arr[0] = this.ctrl.net_no;
int curr_layer = p_list_element.next_room.get_layer();
IntPoint[] check_points = new IntPoint[2];
check_points[0] = p_shape_entry_middle.round();
check_points[1] = connection_point.round();
if (!check_points[0].equals(check_points[1]))
{
Polyline check_polyline = new Polyline(check_points);
boolean check_ok = autoroute_engine.board.check_forced_trace_polyline(check_polyline,
ctrl.trace_half_width[curr_layer], curr_layer, curr_net_no_arr, ctrl.trace_clearance_class_no,
ctrl.max_shove_trace_recursion_depth, ctrl.max_shove_via_recursion_depth,
ctrl.max_spring_over_recursion_depth);
if (!check_ok)
{
continue;
}
}
}
FloatLine new_shape_entry = new FloatLine(connection_point, connection_point);
if (expand_to_door_section(to_door, 0, new_shape_entry, p_list_element,
0, MazeSearchElement.Adjustment.NONE))
{
result = true;
}
}
return result;
}