Index: trunk/src/obj_poly.c =================================================================== --- trunk/src/obj_poly.c (revision 14719) +++ trunk/src/obj_poly.c (revision 14720) @@ -198,6 +198,30 @@ PCB_END_LOOP; } +#if 0 +int pcb_poly_eq(const pcb_element_t *e1, const pcb_line_t *l1, const pcb_element_t *e2, const pcb_line_t *l2) +{ + if (pcb_field_neq(l1, l2, Thickness) || pcb_field_neq(l1, l2, Clearance)) return 0; + if (pcb_element_neq_offsx(e1, l1, e2, l2, Point1.X) || pcb_element_neq_offsy(e1, l1, e2, l2, Point1.Y)) return 0; + if (pcb_element_neq_offsx(e1, l1, e2, l2, Point2.X) || pcb_element_neq_offsy(e1, l1, e2, l2, Point2.Y)) return 0; + if (pcb_neqs(l1->Number, l2->Number)) return 0; + return 1; +} +#endif + +unsigned int pcb_subc_poly_hash(pcb_coord_t ox, pcb_coord_t oy, const pcb_poly_t *p) +{ + unsigned int crd = 0; + pcb_cardinal_t n; + + if (!PCB_FLAG_TEST(PCB_FLAG_FLOATER, p)) + for(n = 0; n < p->PointN; n++) + crd ^= pcb_hash_coord(p->Points[n].X-ox) ^ pcb_hash_coord(p->Points[n].Y-oy); + + return pcb_hash_coord(p->Clearance) ^ pcb_hash_str(p->term) ^ crd; +} + + /* creates a new polygon from the old formats rectangle data */ pcb_poly_t *pcb_poly_new_from_rectangle(pcb_layer_t *Layer, pcb_coord_t X1, pcb_coord_t Y1, pcb_coord_t X2, pcb_coord_t Y2, pcb_coord_t Clearance, pcb_flag_t Flags) { Index: trunk/src/obj_poly.h =================================================================== --- trunk/src/obj_poly.h (revision 14719) +++ trunk/src/obj_poly.h (revision 14720) @@ -76,6 +76,9 @@ void pcb_poly_move(pcb_poly_t *Polygon, pcb_coord_t DX, pcb_coord_t DY); pcb_poly_t *pcb_poly_copy(pcb_poly_t *Dest, pcb_poly_t *Src, pcb_coord_t dx, pcb_coord_t dy); +/* hash */ +unsigned int pcb_subc_poly_hash(pcb_coord_t ox, pcb_coord_t oy, const pcb_poly_t *p); + /* Add objects without creating them or making any "sanity modifications" to them */ void pcb_add_poly_on_layer(pcb_layer_t *Layer, pcb_poly_t *polygon); Index: trunk/src/obj_text.c =================================================================== --- trunk/src/obj_text.c (revision 14719) +++ trunk/src/obj_text.c (revision 14720) @@ -332,8 +332,27 @@ pcb_text_free_str(Text, rendered); } +#if 0 +int pcb_text_eq(const pcb_element_t *e1, const pcb_line_t *l1, const pcb_element_t *e2, const pcb_line_t *l2) +{ + if (pcb_field_neq(l1, l2, Thickness) || pcb_field_neq(l1, l2, Clearance)) return 0; + if (pcb_element_neq_offsx(e1, l1, e2, l2, Point1.X) || pcb_element_neq_offsy(e1, l1, e2, l2, Point1.Y)) return 0; + if (pcb_element_neq_offsx(e1, l1, e2, l2, Point2.X) || pcb_element_neq_offsy(e1, l1, e2, l2, Point2.Y)) return 0; + if (pcb_neqs(l1->Number, l2->Number)) return 0; + return 1; +} +#endif +unsigned int pcb_subc_text_hash(pcb_coord_t ox, pcb_coord_t oy, const pcb_text_t *t) +{ + unsigned int crd = 0; + if (!PCB_FLAG_TEST(PCB_FLAG_FLOATER, t)) + crd = pcb_hash_coord(t->X-ox) ^ pcb_hash_coord(t->Y-oy) ^ pcb_hash_coord(t->Scale); + return pcb_hash_str(t->TextString) ^ pcb_hash_str(t->term) ^ crd; +} + + /*** ops ***/ /* copies a text to buffer */ void *pcb_textop_add_to_buffer(pcb_opctx_t *ctx, pcb_layer_t *Layer, pcb_text_t *Text) Index: trunk/src/obj_text.h =================================================================== --- trunk/src/obj_text.h (revision 14719) +++ trunk/src/obj_text.h (revision 14720) @@ -72,6 +72,9 @@ directly under data - useful e.g. on parent attr change */ void pcb_text_dyn_bbox_update(pcb_data_t *data); +/* hash */ +unsigned int pcb_subc_text_hash(pcb_coord_t ox, pcb_coord_t oy, const pcb_text_t *t); + /* Append dyntext fmt rendered from the perspective of obj */ int pcb_append_dyntext(gds_t *dst, pcb_any_obj_t *obj, const char *fmt);