Пример #1
0
t_point Search(string destination) {
    int tempID = keywordSearchIntersections(destination);
    if (tempID >= 0) {
        update_message(getIntersectionName(tempID));
        return LatLontoCoordinate(getIntersectionPosition(tempID));
    }
    else {
        update_message("No such street intersection(s)");
        return t_point(-1, -1);
    }
}
Пример #2
0
void drawscreen (void)
{
   set_draw_mode(DRAW_NORMAL);
   clearscreen();

   for(auto it = cells.begin(); it != cells.end(); ++it)
   {
      t_point bt_marker = t_point(it->x_pos - 0.3, it->y_pos - 0.3);
      t_bound_box cell_rect = t_bound_box(bt_marker, 0.6, 0.6);
      if (it->fixed)
        setcolor(RED);
      else
        setcolor(BLUE);
      fillrect(cell_rect);
   }

#ifdef _DEBUG_
   setcolor(BLACK);
   for(auto it = virtual_pins.begin(); it != virtual_pins.end(); ++it)
   {
      t_point bt_marker = t_point(it->x_pos - 0.3, it->y_pos - 0.3);
      t_bound_box cell_rect = t_bound_box(bt_marker, 0.6, 0.6);
      fillrect(cell_rect);
   }
#endif

   setcolor(MEDIUMPURPLE);
   setlinestyle(SOLID);
   setlinewidth(1);
   std::vector<int> q_to_c_map;
   q_to_c_map.resize(Q.size());

   unsigned int q_idx=0;
   for(unsigned int i=0; i<cells.size(); i++)
   {
      if (Vertex::v_map_table[i] == -1)
        continue;
      assert(q_idx < Q.size());
      q_to_c_map[q_idx++] = i;
   }

   if (show_nets)
   {
      int drawn_lines =0;
      //draw lines between movable cells
      for(unsigned int c=0; c<Q.size(); c++)
      {
         for(unsigned int r=c+1; r<Q.size(); r++)
         {
            if (Q[c][r] != 0)
            {
                int src_idx = q_to_c_map.at(c);
                int tgt_idx = q_to_c_map.at(r);
                drawline(cells[src_idx].x_pos, cells[src_idx].y_pos, 
                         cells[tgt_idx].x_pos, cells[tgt_idx].y_pos);
                drawn_lines++;
            }
         }
      }
      setcolor(RED);
      setlinestyle(DASHED);
      setlinewidth(1);
      //used edge set to filter 
      std::unordered_set<std::pair<int, int>> u_edges;
      for(auto f_iter = fixed_cells.begin();  f_iter != fixed_cells.end(); ++f_iter)
      {
        std::list<Edge>& adj_cells = f_iter->adj_list;

        //iterating over the edge list to draw
        for(auto t_iter = adj_cells.begin(); t_iter != adj_cells.end(); ++t_iter)
        {
           std::pair<int, int> edge (f_iter->v_id, t_iter->tgt->v_id);
           auto set_idx = u_edges.find(edge);

           //skip if edge is found in the set
           if (set_idx != u_edges.end()) {
              continue;
           }
           u_edges.insert(edge);
           drawline(f_iter->x_pos, f_iter->y_pos, 
                    t_iter->tgt->x_pos, t_iter->tgt->y_pos);
           drawn_lines++;
        }
      }
   }

#ifdef _DEBUG_
   std::cout << "Number of lines drawn: " << drawn_lines << "\n";
#endif
}
Пример #3
0
	t_point cross() const {
		return (t_point(m_y, -m_x));
	}
Пример #4
0
	t_point operator / (const type s) const {
		return (t_point(m_x / s, m_y / s));
	}
Пример #5
0
	t_point operator - (const t_point& p) const {
		return (t_point(m_x - p.x(), m_y - p.y()));
	}
Пример #6
0
box_t t_box(coord_t x1,coord_t y1,coord_t x2,coord_t y2) {
	box_t ret;
	ret.topleft=t_point(x1,y1);
	ret.bottomright=t_point(x2,y2);
	return ret;
}