void GlowNodeClass::measure_javabean( double *pix_x_right, double *pix_x_left, double *pix_y_high, double *pix_y_low) { double jb_x_right = -1e10; double jb_x_left = 1e10; double jb_y_high = -1e10; double jb_y_low = 1e10; GlowNodeClass *base = get_base_nc(); if ( /* (next_nc || prev_nc) && */ !(fabs( base->x0 - base->x1) < DBL_EPSILON || fabs( base->y0 - base->y1) < DBL_EPSILON)) { jb_x_right = base->x1; jb_x_left = base->x0; jb_y_high = base->y1; jb_y_low = base->y0; } else a.get_borders( (GlowTransform *) NULL, &jb_x_right, &jb_x_left, &jb_y_high, &jb_y_low); *pix_x_right = jb_x_right * ctx->mw.zoom_factor_x - double(ctx->mw.offset_x); *pix_x_left = jb_x_left * ctx->mw.zoom_factor_x - double(ctx->mw.offset_x); *pix_y_high = jb_y_high * ctx->mw.zoom_factor_y - double(ctx->mw.offset_y); *pix_y_low = jb_y_low * ctx->mw.zoom_factor_y - double(ctx->mw.offset_y); }
void GlowNodeClass::get_origo( GlowTransform *t, double *x, double *y) { GlowNodeClass *base = get_base_nc(); if ( /* (next_nc || prev_nc) && */ !(fabs( base->x0 - base->x1) < DBL_EPSILON || fabs( base->y0 - base->y1) < DBL_EPSILON)) { // Borders are given i x0, y0, x1, y1 if ( t) { double ll_x, ll_y, ur_x, ur_y; ll_x = ll_y = 1e37; ur_x = ur_y = -1e37; get_borders( t, &ur_x, &ll_x, &ur_y, &ll_y); *x = t->x( 0, 0) - ll_x; *y = t->y( 0, 0) - ll_y; } else { *x = - base->x0; *y = - base->y0; } } else { double ll_x, ll_y, ur_x, ur_y; ll_x = ll_y = 1e37; ur_x = ur_y = -1e37; a.get_borders( t, &ur_x, &ll_x, &ur_y, &ll_y); *x = -ll_x; *y = -ll_y; } }
void GlowNodeClass::get_borders(GlowTransform* t, double* x_right, double* x_left, double* y_high, double* y_low) { GlowNodeClass* base = get_base_nc(); if ((!t || (t && fabs(t->rotation / 90 - int(t->rotation / 90)) < DBL_EPSILON)) && /* (next_nc || prev_nc) && */ !(fabs(base->x0 - base->x1) < DBL_EPSILON || fabs(base->y0 - base->y1) < DBL_EPSILON)) { // Borders are given i x0, y0, x1, y1 // Will not work in rotated nodes double ll_x, ur_x, ll_y, ur_y, kx1, kx2, ky1, ky2; if (t) { kx1 = t->x(base->x0, base->y0); kx2 = t->x(base->x1, base->y1); ky1 = t->y(base->x0, base->y0); ky2 = t->y(base->x1, base->y1); } else { kx1 = base->x0; kx2 = base->x1; ky1 = base->y0; ky2 = base->y1; } ll_x = MIN(kx1, kx2); ur_x = MAX(kx1, kx2); ll_y = MIN(ky1, ky2); ur_y = MAX(ky1, ky2); if (ll_x < *x_left) *x_left = ll_x; if (ur_x > *x_right) *x_right = ur_x; if (ll_y < *y_low) *y_low = ll_y; if (ur_y > *y_high) *y_high = ur_y; } else a.get_borders(t, x_right, x_left, y_high, y_low); }