void dgnss_init(u8 num_sats, sdiff_t *sdiffs, double receiver_ecef[3]) { DEBUG_ENTRY(); sdiff_t corrected_sdiffs[num_sats]; init_sats_management(&sats_management, num_sats, sdiffs, corrected_sdiffs); create_ambiguity_test(&ambiguity_test); if (num_sats <= 1) { DEBUG_EXIT(); return; } double dd_measurements[2*(num_sats-1)]; make_measurements(num_sats-1, corrected_sdiffs, dd_measurements); set_nkf( &nkf, dgnss_settings.amb_drift_var, dgnss_settings.phase_var_kf, dgnss_settings.code_var_kf, dgnss_settings.amb_init_var, num_sats, corrected_sdiffs, dd_measurements, receiver_ecef ); DEBUG_EXIT(); }
/** Finds the baseline using low latency sdiffs. * The low latency sdiffs are not guaranteed to match up with either the * amb_test's or the float sdiffs, and thus care must be taken to transform them * accordingly and check their availability in those sat sets. * * \param num_sdiffs The number of low-latency sdiffs provided. * \param sdiffs The low-latency sdiffs. * \param ref_ecef The referece position for the baseline. * (TODO is this the local or remote receiver position?) * \param s Current ambiguity test state. * \param num_used Output number of sdiffs actually used in the baseline * estimate. * \param b Output baseline. * \param disable_raim Flag to turn off raim checks/repair. * \param raim_threshold raim check threshold * \return 1 if we are using an IAR resolved baseline. * 2 if we are using a float baseline. * -1 if we can't give a baseline. */ s8 dgnss_baseline(u8 num_sdiffs, const sdiff_t *sdiffs, const double ref_ecef[3], const ambiguity_state_t *s, u8 *num_used, double b[3], bool disable_raim, double raim_threshold) { s8 ret = baseline(num_sdiffs, sdiffs, ref_ecef, &s->fixed_ambs, num_used, b, disable_raim, raim_threshold); if (ret >= 0) { if (ret == 1) /* TODO: Export this rather than just printing */ log_warn("dgnss_baseline: Fixed baseline RAIM repair"); log_debug("fixed solution"); DEBUG_EXIT(); return 1; } /* We weren't able to get an IAR resolved baseline, check if we can get a * float baseline. */ if ((ret = baseline(num_sdiffs, sdiffs, ref_ecef, &s->float_ambs, num_used, b, disable_raim, raim_threshold)) >= 0) { if (ret == 1) /* TODO: Export this rather than just printing */ log_warn("dgnss_baseline: Float baseline RAIM repair"); log_debug("float solution"); DEBUG_EXIT(); return 2; } log_debug("no baseline solution"); DEBUG_EXIT(); return ret; }
/** Finds the baseline using low latency sdiffs. * The low latency sdiffs are not guaranteed to match up with either the * amb_test's or the float sdiffs, and thus care must be taken to transform them * accordingly and check their availability in those sat sets. * * \param num_sdiffs The number of low-latency sdiffs provided. * \param sdiffs The low-latency sdiffs. * \param ref_ecef The referece position for the baseline. * (TODO is this the local or remote receiver position?) * \param num_used Output number of sdiffs actually used in the baseline * estimate. * \param b Output baseline. * \return 1 if we are using an IAR resolved baseline. * 2 if we are using a float baseline. * -1 if we can't give a baseline. */ s8 dgnss_low_latency_baseline(u8 num_sdiffs, sdiff_t *sdiffs, double ref_ecef[3], u8 *num_used, double b[3]) { DEBUG_ENTRY(); if (num_sdiffs < 4 || sats_management.num_sats < 4) { /* For a position solution, we need at least 4 sats. That means we must * have at least 4 sats in common between what the filters are tracking and * the sdiffs we give this function. If num_sdiffs, or the number of KF * sats is less than 4, this criterion cannot be satisfied. */ log_debug("Low latency solution can't be computed. Too few observations" " or too few sats in the current filter.\n"); DEBUG_EXIT(); return -1; } if (0 == _dgnss_low_latency_IAR_baseline(num_sdiffs, sdiffs, ref_ecef, num_used, b)) { log_debug("low latency IAR solution\n"); DEBUG_EXIT(); return 1; } /* if we get here, we weren't able to get an IAR resolved baseline. * Check if we can get a float baseline. */ s8 float_ret_code = _dgnss_low_latency_float_baseline(num_sdiffs, sdiffs, ref_ecef, num_used, b); if (float_ret_code == 0) { log_debug("low latency float solution\n"); DEBUG_EXIT(); return 2; } log_debug("no low latency solution\n"); DEBUG_EXIT(); return -1; }
/** Constructs a low latency float baseline measurement. * The sdiffs have no particular reason (other than a general tendency * brought by hysteresis) to match up with the float filter's sats, so we have * to check if we can solve. For now, unless the sdiffs are a superset of the * float sats, we don't solve. * * Requires num_sdiffs >= 4 and (global) sats_management.num_sats >= 4. * * \TODO solve whenever the information is there. * * \TODO since we're now using make_dd_measurements_and_sdiffs outside of the * amb_test context, pull it into another file. * * \TODO pull this function into the KF, once we pull the sats_management struct * into the KF too. When we do, do the same for the IAR low lat solution. * * \param num_sdiffs The number of sdiffs input. Must be >= 4. * \param sdiffs The sdiffs used to measure. (These should be a superset * of the float sats). * \param ref_ecef The reference position used for solving, and making * observation matrices. * \param num_used The number of sats actually used to compute the baseline. * \param b The baseline computed. * \return -1 if it can't solve. * 0 If it can solve. */ s8 _dgnss_low_latency_float_baseline(u8 num_sdiffs, sdiff_t *sdiffs, double ref_ecef[3], u8 *num_used, double b[3]) { DEBUG_ENTRY(); if (num_sdiffs < 4 || sats_management.num_sats < 4) { /* For a position solution, we need at least 4 sats. That means we must * have at least 4 sats in common between what the KF is tracking and * the sdiffs we give this function. If either is less than 4, * this criterion cannot be satisfied. */ log_debug("Low latency solution can't be computed. Too few observations" " or too few sats in the current filter.\n"); DEBUG_EXIT(); return -1; } double float_dd_measurements[2 * (sats_management.num_sats - 1)]; sdiff_t float_sdiffs[sats_management.num_sats]; s8 can_make_obs = make_dd_measurements_and_sdiffs(sats_management.prns[0], &sats_management.prns[1], sats_management.num_sats - 1, num_sdiffs, sdiffs, float_dd_measurements, float_sdiffs); if (can_make_obs == -1) { log_debug("make_float_dd_measurements_and_sdiffs has error code -1\n"); DEBUG_EXIT(); return -1; } least_squares_solve_b(&nkf, float_sdiffs, float_dd_measurements, ref_ecef, b); *num_used = sats_management.num_sats; DEBUG_EXIT(); return 0; }
/** Updates sats to the new measurements' sat set */ s8 rebase_sats_management(sats_management_t *sats_management, const u8 num_sdiffs, const sdiff_t *sdiffs, sdiff_t *sdiffs_with_ref_first) { DEBUG_ENTRY(); s8 return_code; u8 ref_prn; if (sats_management->num_sats <= 1) { // Need to init first. init_sats_management(sats_management, num_sdiffs, sdiffs, 0); } // Check if old reference is in sdiffs if (bsearch(&(sats_management->prns[0]), sdiffs, num_sdiffs, sizeof(sdiff_t), &sdiff_search_prn)) { ref_prn = sats_management->prns[0]; return_code = OLD_REF; } else { sdiff_t intersection_sats[num_sdiffs]; u8 num_intersection = intersect_sats(sats_management->num_sats-1, num_sdiffs, &(sats_management->prns[1]), sdiffs, intersection_sats); if (num_intersection < INTERSECTION_SATS_THRESHOLD_SIZE) { DEBUG_EXIT(); return NEW_REF_START_OVER; } else { if (DEBUG) { printf("sdiff prns= {"); for (u8 yo_mama=0; yo_mama< num_sdiffs; yo_mama++) { printf("%u, ", sdiffs[yo_mama].prn); } printf("}\n"); printf("sats_man_prns= {"); for (u8 so_fetch=0; so_fetch < sats_management->num_sats; so_fetch++) { printf("%u, ", sats_management->prns[so_fetch]); } printf("}\n"); printf("num intersect_sats= %u\nintersection= {", num_intersection); for (u8 bork=0; bork<num_intersection; bork++) { printf("%u, ", intersection_sats[bork].prn); } printf("}\n"); } ref_prn = choose_reference_sat(num_intersection, intersection_sats); return_code = NEW_REF; } } set_reference_sat(ref_prn, sats_management, num_sdiffs, sdiffs, sdiffs_with_ref_first); DEBUG_EXIT(); return return_code; }
void calculateExonViewHighlightBoxBorders(GtkWidget *exonView) { DEBUG_ENTER("calculateExonViewHighlightBoxBorders"); ExonViewProperties *properties = exonViewGetProperties(exonView); BlxViewContext *bc = bigPictureGetContext(properties->bigPicture); /* Get the big picture display range in dna coords */ IntRange bpRange; convertDisplayRangeToDnaRange(bigPictureGetDisplayRange(properties->bigPicture), bc->seqType, bc->numFrames, bc->displayRev, &bc->refSeqRange, &bpRange); /* Get the detail view display range in dna coords */ IntRange dvRange; GtkWidget *detailView = bigPictureGetDetailView(properties->bigPicture); convertDisplayRangeToDnaRange(detailViewGetDisplayRange(detailView), bc->seqType, bc->numFrames, bc->displayRev, &bc->refSeqRange, &dvRange); /* Calculate how many pixels from the left edge of the widget to the first base in the range. */ const int x1 = convertBaseIdxToRectPos(dvRange.min, &properties->exonViewRect, &bpRange, TRUE, bc->displayRev, TRUE); const int x2 = convertBaseIdxToRectPos(dvRange.max + 1, &properties->exonViewRect, &bpRange, TRUE, bc->displayRev, TRUE); properties->highlightRect.x = min(x1, x2); properties->highlightRect.y = 0; properties->highlightRect.width = abs(x1 - x2); properties->highlightRect.height = exonView->allocation.height; DEBUG_EXIT("calculateExonViewHighlightBoxBorders returning"); }
svg_status_t _svg_android_end_group (void *closure, double opacity) { svg_android_t *svg_android = closure; DEBUG_ENTRY("end_group"); if (opacity != 1.0) { svg_android->state->matrix = ANDROID_IDENTITY_MATRIX(svg_android); svg_android->state->matrix = (*(svg_android->env))->NewGlobalRef( svg_android->env, svg_android->state->matrix); ANDROID_DRAW_BITMAP(svg_android, svg_android->state->offscreen_bitmap, svg_android->state->matrix); (*(svg_android->env))->DeleteGlobalRef(svg_android->env, svg_android->state->offscreen_bitmap); svg_android->state->offscreen_bitmap = NULL; } _svg_android_pop_state (svg_android); ANDROID_RESTORE(svg_android); DEBUG_EXIT("end_group"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_set_stroke_line_cap (void *closure, svg_stroke_line_cap_t line_cap) { svg_android_t *svg_android = closure; DEBUG_ENTRY("set_stroke_line_cap"); switch (line_cap) { case SVG_STROKE_LINE_CAP_BUTT: ANDROID_SET_STROKE_CAP(svg_android, svg_android->state->paint, 0); break; case SVG_STROKE_LINE_CAP_ROUND: ANDROID_SET_STROKE_CAP(svg_android, svg_android->state->paint, 1); break; case SVG_STROKE_LINE_CAP_SQUARE: ANDROID_SET_STROKE_CAP(svg_android, svg_android->state->paint, 2); break; } svg_android->state->line_cap = line_cap; DEBUG_EXIT("set_stroke_line_cap"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_render_line (void *closure, svg_length_t *x1_len, svg_length_t *y1_len, svg_length_t *x2_len, svg_length_t *y2_len) { svg_android_t *svg_android = closure; svg_status_t status; double x1, y1, x2, y2; DEBUG_ENTRY("render_line"); _svg_android_length_to_pixel (svg_android, x1_len, &x1); _svg_android_length_to_pixel (svg_android, y1_len, &y1); _svg_android_length_to_pixel (svg_android, x2_len, &x2); _svg_android_length_to_pixel (svg_android, y2_len, &y2); status = _svg_android_move_to (svg_android, x1, y1); if (status) return status; status = _svg_android_line_to (svg_android, x2, y2); if (status) return status; status = _svg_android_render_path (svg_android); if (status) return status; DEBUG_EXIT("render_line"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_transform (void *closure, double xx, double yx, double xy, double yy, double x0, double y0) { svg_android_t *svg_android = closure; jobject new_matrix; jobject old_matrix = svg_android->state->matrix; DEBUG_ENTRY("transform"); new_matrix = ANDROID_MATRIX_INIT(svg_android, xx, yx, xy, yy, x0, y0); ANDROID_MATRIX_MULTIPLY(svg_android, new_matrix, old_matrix); svg_android->state->matrix = (*(svg_android->env))->NewGlobalRef( svg_android->env, new_matrix); (*(svg_android->env))->DeleteGlobalRef(svg_android->env, old_matrix); DEBUG_EXIT("transform"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_begin_group (void *closure, double opacity) { svg_android_t *svg_android = closure; jobject offscreen_bitmap = NULL; DEBUG_ENTRY("begin_group"); ANDROID_SAVE(svg_android); if (opacity != 1.0) { opacity *= 255; jint opacity_i = opacity; opacity_i = ((opacity_i & 0xff) << 24) & 0xffffffff; offscreen_bitmap = ANDROID_CREATE_BITMAP(svg_android, svg_android->state->viewport_width, svg_android->state->viewport_height); ANDROID_FILL_BITMAP(svg_android, offscreen_bitmap, opacity_i); svg_android->state->offscreen_bitmap = offscreen_bitmap; } else svg_android->state->offscreen_bitmap = NULL; _svg_android_push_state (svg_android, offscreen_bitmap); DEBUG_EXIT("begin_group"); return SVG_ANDROID_STATUS_SUCCESS; }
void init_sats_management(sats_management_t *sats_management, const u8 num_sdiffs, const sdiff_t *sdiffs, sdiff_t *sdiffs_with_ref_first) { DEBUG_ENTRY(); if (num_sdiffs == 0) { sats_management->num_sats = 0; DEBUG_EXIT(); return; } u8 ref_prn = choose_reference_sat(num_sdiffs, sdiffs); set_reference_sat_and_prns(ref_prn, sats_management, num_sdiffs, sdiffs, sdiffs_with_ref_first); DEBUG_EXIT(); }
static void dgnss_update_sats(u8 num_sdiffs, double receiver_ecef[3], sdiff_t *sdiffs_with_ref_first, double *dd_measurements) { DEBUG_ENTRY(); (void)dd_measurements; gnss_signal_t new_sids[num_sdiffs]; sdiffs_to_sids(num_sdiffs, sdiffs_with_ref_first, new_sids); gnss_signal_t old_sids[MAX_CHANNELS]; memcpy(old_sids, sats_management.sids, sats_management.num_sats * sizeof(gnss_signal_t)); if (!sids_match(&old_sids[1], num_sdiffs-1, &sdiffs_with_ref_first[1])) { u8 ndx_of_intersection_in_old[sats_management.num_sats]; u8 ndx_of_intersection_in_new[sats_management.num_sats]; ndx_of_intersection_in_old[0] = 0; ndx_of_intersection_in_new[0] = 0; u8 num_intersection_sats = dgnss_intersect_sats( sats_management.num_sats-1, &old_sids[1], num_sdiffs-1, &sdiffs_with_ref_first[1], &ndx_of_intersection_in_old[1], &ndx_of_intersection_in_new[1]) + 1; set_nkf_matrices( &nkf, dgnss_settings.phase_var_kf, dgnss_settings.code_var_kf, num_sdiffs, sdiffs_with_ref_first, receiver_ecef ); if (num_intersection_sats < sats_management.num_sats) { /* we lost sats */ nkf_state_projection(&nkf, sats_management.num_sats-1, num_intersection_sats-1, &ndx_of_intersection_in_old[1]); } if (num_intersection_sats < num_sdiffs) { /* we gained sats */ double simple_estimates[num_sdiffs-1]; dgnss_simple_amb_meas(num_sdiffs, sdiffs_with_ref_first, simple_estimates); nkf_state_inclusion(&nkf, num_intersection_sats-1, num_sdiffs-1, &ndx_of_intersection_in_new[1], simple_estimates, dgnss_settings.new_int_var); } update_sats_sats_management(&sats_management, num_sdiffs-1, &sdiffs_with_ref_first[1]); } else { set_nkf_matrices( &nkf, dgnss_settings.phase_var_kf, dgnss_settings.code_var_kf, num_sdiffs, sdiffs_with_ref_first, receiver_ecef ); } DEBUG_EXIT(); }
static void onSizeAllocateExonView(GtkWidget *exonView, GtkAllocation *allocation, gpointer data) { DEBUG_ENTER("onSizeAllocateExonView"); calculateExonViewBorders(exonView); DEBUG_EXIT("onSizeAllocateExonView returning"); }
void calculateExonViewHeight(GtkWidget *exonView) { DEBUG_ENTER("calculateExonViewHeight"); ExonViewProperties *properties = exonViewGetProperties(exonView); BigPictureProperties *bpProperties = bigPictureGetProperties(properties->bigPicture); const IntRange* const displayRange = &bpProperties->displayRange; BlxViewContext *bc = blxWindowGetContext(bpProperties->blxWindow); /* Calculate the height based on how many exon lines will actually be drawn */ int numExons = 0; int maxExons = properties->expanded ? UNSET_INT : 1; /* unset means no limit */ /* Loop through all sequences */ GList *seqItem = bc->matchSeqs; for ( ; seqItem; seqItem = seqItem->next) { /* Loop through all msps */ const BlxSequence *seq = (BlxSequence*)(seqItem->data); GList *mspItem = seq->mspList; for ( ; mspItem; mspItem = mspItem->next) { const MSP *msp = (const MSP*)(mspItem->data); if (showMspInExonView(msp, properties->currentStrand, bc)) { const IntRange* const mspDisplayRange = mspGetDisplayRange(msp); if (rangesOverlap(mspDisplayRange, displayRange)) { ++numExons; break; /* break inner loop and move to next sequence */ } } } /* Break after we've found the maximum number of lines, if a max is specified */ if (maxExons != UNSET_INT && numExons >= maxExons) { break; } } const int newHeight = (numExons * (properties->exonHeight + properties->yPad)) + (2 * properties->yPad); if (newHeight != properties->exonViewRect.height) { DEBUG_OUT("Setting new height = %d\n", newHeight); properties->exonViewRect.height = newHeight; gtk_widget_set_size_request(exonView, -1, properties->exonViewRect.height); } DEBUG_EXIT("calculateExonViewHeight returning"); }
svg_status_t _svg_android_set_stroke_opacity (void *closure, double stroke_opacity) { svg_android_t *svg_android = closure; DEBUG_ENTRY("set_stroke_opacity"); svg_android->state->stroke_opacity = stroke_opacity; DEBUG_EXIT("set_stroke_opacity"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_set_stroke_dash_offset (void *closure, svg_length_t *offset_len) { svg_android_t *svg_android = closure; double offset; DEBUG_ENTRY("set_stroke_dash_offset"); _svg_android_length_to_pixel (svg_android, offset_len, &offset); svg_android->state->dash_offset = offset; if (svg_android->state->num_dashes) { jfloatArray farr; // prepare Android float array with dashes, make sure the array is even in length.. { int max_k; int k; jfloat *buf; max_k = svg_android->state->num_dashes; if(max_k & 0x1) max_k++; // make even buf = (jfloat *)malloc(sizeof(jfloat) * max_k); if(buf == NULL) return SVG_STATUS_NO_MEMORY; farr = (*(svg_android->env))->NewFloatArray(svg_android->env, max_k); if (farr == NULL) { free(buf); return SVG_ANDROID_STATUS_NO_MEMORY; /* out of memory error thrown */ } for(k = 0; k < svg_android->state->num_dashes; k++) { buf[k] = svg_android->state->dash[k]; } for(; k < max_k; k++) buf[k] = 0.0; (*(svg_android->env))->SetFloatArrayRegion(svg_android->env, farr, 0, max_k, buf); free(buf); } jobject effect = ANDROID_GET_DASHEFFECT( svg_android, farr, svg_android->state->dash_offset); ANDROID_PAINT_SET_EFFECT(svg_android, effect); } DEBUG_EXIT("set_stroke_dash_offset"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_set_color (void *closure, const svg_color_t *color) { svg_android_t *svg_android = closure; DEBUG_ENTRY("set_color"); svg_android->state->color = *color; DEBUG_EXIT("set_color"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_set_stroke_paint (void *closure, const svg_paint_t *paint) { svg_android_t *svg_android = closure; DEBUG_ENTRY("set_stroke_paint"); svg_android->state->stroke_paint = *paint; DEBUG_EXIT("set_stroke_paint"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_set_text_anchor (void *closure, svg_text_anchor_t text_anchor) { svg_android_t *svg_android = closure; DEBUG_ENTRY("set_text_anchor"); svg_android->state->text_anchor = text_anchor; DEBUG_EXIT("set_text_anchor"); return SVG_ANDROID_STATUS_SUCCESS; }
/** Constructs a low latency IAR resolved baseline measurement. * The sdiffs have no particular reason (other than a general tendency * brought by hysteresis) to match up with the IAR sats, so we have * to check if we can solve. For now, unless the sdiffs are a superset of the * IAR sats, we don't solve. * * Requires num_sdiffs >= 4. * * \TODO, solve whenever we can * * \TODO since we're now using make_dd_measurements_and_sdiffs outside of the * amb_test context, pull it into another file. * * \TODO pull this into the IAR file when we do the same for the float low lat * solution. * * \todo This function is identical to dgnss_fixed_baseline()? * * \param num_sdiffs The number of sdiffs input. * \param sdiffs The sdiffs used to measure. (These should be a superset * of the float sats). * \param ref_ecef The reference position used for solving, and making * observation matrices. * \param num_used The number of sats actually used to compute the baseline. * \param b The baseline computed. * \return -1 if it can't solve. * 0 If it can solve. */ s8 _dgnss_low_latency_IAR_baseline(u8 num_sdiffs, sdiff_t *sdiffs, double ref_ecef[3], u8 *num_used, double b[3]) { DEBUG_ENTRY(); assert(num_sdiffs >= 4); if (!ambiguity_iar_can_solve(&ambiguity_test)) { DEBUG_EXIT(); return -1; } sdiff_t ambiguity_sdiffs[ambiguity_test.amb_check.num_matching_ndxs+1]; double dd_meas[2 * ambiguity_test.amb_check.num_matching_ndxs]; s8 valid_sdiffs = make_ambiguity_resolved_dd_measurements_and_sdiffs( &ambiguity_test, num_sdiffs, sdiffs, dd_meas, ambiguity_sdiffs); if (valid_sdiffs != 0) { if (valid_sdiffs != -1) { log_error("_dgnss_low_latency_IAR_baseline: Invalid sdiffs."); } DEBUG_EXIT(); return -1; } /* TODO: check internals of this if's content and abstract it from the KF */ double DE[ambiguity_test.amb_check.num_matching_ndxs * 3]; assign_de_mtx(ambiguity_test.amb_check.num_matching_ndxs + 1, ambiguity_sdiffs, ref_ecef, DE); *num_used = ambiguity_test.amb_check.num_matching_ndxs + 1; s8 ret = lesq_solution_int(ambiguity_test.amb_check.num_matching_ndxs, dd_meas, ambiguity_test.amb_check.ambs, DE, b, 0); if (ret) { log_error("_dgnss_low_latency_IAR_baseline: " "lesq_solution returned error %d\n", ret); DEBUG_EXIT(); return -1; } DEBUG_EXIT(); return 0; }
svg_status_t _svg_android_set_font_size (void *closure, double size) { svg_android_t *svg_android = closure; DEBUG_ENTRY("set_font_size"); svg_android->state->font_size = size; svg_android->state->font_dirty = 1; DEBUG_EXIT("set_font_size"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_set_font_style (void *closure, svg_font_style_t font_style) { svg_android_t *svg_android = closure; DEBUG_ENTRY("set_font_style"); svg_android->state->font_style = font_style; svg_android->state->font_dirty = 1; DEBUG_EXIT("set_font_style"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_set_font_weight (void *closure, unsigned int font_weight) { svg_android_t *svg_android = closure; DEBUG_ENTRY("set_font_weight"); svg_android->state->font_weight = font_weight; svg_android->state->font_dirty = 1; DEBUG_EXIT("set_font_weight"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_render_rect (void *closure, svg_length_t *x_len, svg_length_t *y_len, svg_length_t *width_len, svg_length_t *height_len, svg_length_t *rx_len, svg_length_t *ry_len) { svg_android_t *svg_android = closure; double x, y, width, height, rx, ry; DEBUG_ENTRY("render_rect"); _svg_android_length_to_pixel (svg_android, x_len, &x); _svg_android_length_to_pixel (svg_android, y_len, &y); _svg_android_length_to_pixel (svg_android, width_len, &width); _svg_android_length_to_pixel (svg_android, height_len, &height); _svg_android_length_to_pixel (svg_android, rx_len, &rx); _svg_android_length_to_pixel (svg_android, ry_len, &ry); if (rx > width / 2.0) rx = width / 2.0; if (ry > height / 2.0) ry = height / 2.0; if (rx > 0 || ry > 0) { _svg_android_move_to (svg_android, x + rx, y); _svg_android_line_to (svg_android, x + width - rx, y); _svg_android_arc_to (svg_android, rx, ry, 0, 0, 1, x + width, y + ry); _svg_android_line_to (svg_android, x + width, y + height - ry); _svg_android_arc_to (svg_android, rx, ry, 0, 0, 1, x + width - rx, y + height); _svg_android_line_to (svg_android, x + rx, y + height); _svg_android_arc_to (svg_android, rx, ry, 0, 0, 1, x, y + height - ry); _svg_android_line_to (svg_android, x, y + ry); _svg_android_arc_to (svg_android, rx, ry, 0, 0, 1, x + rx, y); } else { _svg_android_move_to (svg_android, x, y); _svg_android_line_to (svg_android, x + width, y); _svg_android_line_to (svg_android, x + width, y + height); _svg_android_line_to (svg_android, x, y + height); } _svg_android_close_path (svg_android); _svg_android_render_path (svg_android); DEBUG_EXIT("render_rect"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_end_element (void *closure) { svg_android_t *svg_android = closure; DEBUG_ENTRY("end_element"); _svg_android_pop_state (svg_android); ANDROID_RESTORE(svg_android); DEBUG_EXIT("end_element"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_set_stroke_miter_limit (void *closure, double limit) { svg_android_t *svg_android = closure; DEBUG_ENTRY("set_stroke_miter_limit"); ANDROID_PAINT_SET_MITER_LIMIT(svg_android, limit); svg_android->state->miter_limit = limit; DEBUG_EXIT("set_stroke_miter_limit"); return SVG_ANDROID_STATUS_SUCCESS; }
svg_status_t _svg_android_close_path (void *closure) { svg_android_t *svg_android = closure; DEBUG_ENTRY("close_path"); ANDROID_PATH_CLOSE(svg_android); svg_android->state->last_x = 0.0; // don't know if this is right, really... svg_android->state->last_y = 0.0; DEBUG_EXIT("close_path"); return SVG_ANDROID_STATUS_SUCCESS; }
void make_measurements(u8 num_double_diffs, const sdiff_t *sdiffs, double *raw_measurements) { DEBUG_ENTRY(); double phase0 = sdiffs[0].carrier_phase; double code0 = sdiffs[0].pseudorange; for (u8 i=0; i<num_double_diffs; i++) { raw_measurements[i] = sdiffs[i+1].carrier_phase - phase0; raw_measurements[i+num_double_diffs] = sdiffs[i+1].pseudorange - code0; } DEBUG_EXIT(); }
svg_status_t _svg_android_line_to (void *closure, double x, double y) { svg_android_t *svg_android = closure; DEBUG_ENTRY("line_to"); ANDROID_PATH_LINE_TO(svg_android, x, y); svg_android->state->last_x = x; svg_android->state->last_y = y; DEBUG_EXIT("line_to"); return SVG_ANDROID_STATUS_SUCCESS; }