JSON::Pos JSON::skipElement() const { //std::cerr << "skipElement()\t" << data() << std::endl; ElementType type = getType(); switch(type) { case TYPE_NULL: return skipNull(); case TYPE_BOOL: return skipBool(); case TYPE_NUMBER: return skipNumber(); case TYPE_STRING: return skipString(); case TYPE_NAME_VALUE_PAIR: return skipNameValuePair(); case TYPE_ARRAY: return skipArray(); case TYPE_OBJECT: return skipObject(); default: throw JSONException("Logical error in JSON: unknown element type: " + Poco::NumberFormatter::format(type)); } }
/*---------------------------------------------------------------------- animate_box_transformation : animate the scale, translate, skew, rotate... ----------------------------------------------------------------------*/ static void animate_box_transformation (PtrElement El, Animated_Element *animated, AnimTime current_time) { int doc, view; float fx, fy, tx, ty, rotf, rott; float result; long int trans_type; PtrTransform Trans = NULL; char* ptr; if (animated->AttrName == NULL) return; trans_type = (long int)(animated->AttrName); /*translate, scale, rotate_, skewX, skewY*/ switch (trans_type) { case 1 : /* translate */ FrameToView (Animated_Frame, &doc, &view); tx = ty = fx = fy = 0; /* default values */ /* parse the "to" attribute */ ptr = (char *) animated->to; ptr = skipWsp (ptr); tx = T_atof (ptr); ptr = skipNumber (ptr); ptr = skipCommaWsp (ptr); if (*ptr == EOS) ty = tx; else ty = T_atof (ptr); /* parse the "from" attribute */ ptr = (char *) animated->from; ptr = skipWsp (ptr); fx = T_atof (ptr); ptr = skipNumber (ptr); ptr = skipCommaWsp (ptr); if (*ptr == EOS) fy = fx; else fy = T_atof (ptr); tx = (float) interpolate_double_value (fx, tx, current_time, animated->duration); ty = (float) interpolate_double_value (fy, ty, current_time, animated->duration); if (El->ElTransform) Trans = GetTransformation (El->ElTransform, PtElTranslate); if (Trans == NULL) { Trans = (PtrTransform)TtaNewTransformTranslate (tx, ty); TtaReplaceTransform ((Element) El, Trans, doc); } Trans->XScale = tx; Trans->YScale = ty; break; case 2 : /* scale */ FrameToView (Animated_Frame, &doc, &view); tx = ty = fx = fy = 0; /* default values */ /* parse the "to" attribute */ ptr = (char *) animated->to; ptr = skipWsp (ptr); tx = T_atof (ptr); ptr = skipNumber (ptr); ptr = skipCommaWsp (ptr); if (*ptr == EOS) ty = tx; else ty = T_atof (ptr); /* parse the "from" attribute */ ptr = (char *) animated->from; ptr = skipWsp (ptr); fx = T_atof (ptr); ptr = skipNumber (ptr); ptr = skipCommaWsp (ptr); if (*ptr == EOS) fy = fx; else fy = T_atof (ptr); tx = (float) interpolate_double_value (fx, tx, current_time, animated->duration); ty = (float) interpolate_double_value (fy, ty, current_time, animated->duration); if (El->ElTransform) Trans = GetTransformation (El->ElTransform, PtElScale); if (Trans == NULL) { Trans = (PtrTransform)TtaNewTransformScale (tx, ty); TtaReplaceTransform ((Element) El, Trans, doc); } Trans->XScale = tx; Trans->YScale = ty; break; case 3 : /* Rotate */ FrameToView (Animated_Frame, &doc, &view); rott = tx = ty = rotf = fx = fy = 0; /* default values */ /* parse the "to" attribute */ ptr = (char *) animated->to; ptr = skipWsp (ptr); rott = T_atof (ptr); /* angle */ ptr = skipNumber (ptr); ptr = skipCommaWsp (ptr); if (*ptr != EOS) { tx = T_atof (ptr); /* x coord. of center of rotation */ ptr = skipNumber (ptr); ptr = skipCommaWsp (ptr); ty = T_atof (ptr); /* y coord. of center of rotation */ } /* parse the "from" attribute */ ptr = (char *) animated->from; ptr = skipWsp (ptr); rotf = T_atof (ptr); /* angle */ ptr = skipNumber (ptr); ptr = skipCommaWsp (ptr); if (*ptr != EOS) { fx = T_atof (ptr); /* x coord. of center of rotation */ ptr = skipNumber (ptr); ptr = skipCommaWsp (ptr); fy = T_atof (ptr); /* y coord. of center of rotation */ } if (tx && fx) tx = (float) interpolate_double_value (fx, tx, current_time, animated->duration); if (ty && fy) ty = (float) interpolate_double_value (fy, ty, current_time, animated->duration); rott = (float)interpolate_double_value (rotf, rott, current_time, animated->duration); if (El->ElTransform) Trans = GetTransformation (El->ElTransform, PtElRotate); if (Trans == NULL) { Trans = (PtrTransform)TtaNewTransformRotate (rott, tx, ty); TtaReplaceTransform ((Element) El, Trans, doc); } Trans->TrAngle = rott; Trans->XRotate = tx; Trans->YRotate = ty; break; case 4 : /* skewX */ FrameToView (Animated_Frame, &doc, &view); /* parse the "to" attribute */ ptr = (char *) animated->to; ptr = skipWsp (ptr); tx = T_atof (ptr); /* parse the "from" attribute */ ptr = (char *) animated->from; ptr = skipWsp (ptr); fx = T_atof (ptr); result = (float)interpolate_double_value (fx, tx, current_time, animated->duration); if (El->ElTransform) Trans = GetTransformation (El->ElTransform, PtElSkewX); if (Trans == NULL) { Trans = (PtrTransform)TtaNewTransformSkewX (result); TtaReplaceTransform ((Element) El, Trans, doc); } Trans->TrFactor = result; break; case 5 : /* skewY */ FrameToView (Animated_Frame, &doc, &view); /* parse the "to" attribute */ ptr = (char *) animated->to; ptr = skipWsp (ptr); ty = T_atof (ptr); /* parse the "from" attribute */ ptr = (char *) animated->from; ptr = skipWsp (ptr); fy = T_atof (ptr); result = (float)interpolate_double_value (fy, ty, current_time, animated->duration); if (El->ElTransform) Trans = GetTransformation (El->ElTransform, PtElSkewY); if (Trans == NULL) { Trans = (PtrTransform)TtaNewTransformSkewY (result); TtaReplaceTransform ((Element) El, Trans, doc); } Trans->TrFactor = result; break; } }