/// /// <summary> * fitsRotateMod - checks whether matrix matches the AllowedRotateMod or /// * PresentRotateMod, specified for this State /// * </summary> /// * <param name="matrix"> /// * matrix to test </param> /// * <param name="rotatemod"> /// * switches between AllowedRotateMod and PresentRotateMod. </param> /// * <returns> boolean - true, if <code>matrix</code> matches the RotateMod or /// * if AllowedRotateMod is not specified </returns> /// private bool fitsRotateMod(JDFMatrix matrix, EnumFitsValue rotatemod) { if (rotatemod == null || rotatemod.Equals(EnumFitsValue.Allowed)) { if (!hasAttribute(AttributeName.ALLOWEDROTATEMOD)) { return(true); } } else { if (!hasAttribute(AttributeName.ALLOWEDROTATEMOD) && !hasAttribute(AttributeName.PRESENTROTATEMOD)) { return(true); } } double rm; if (rotatemod == null || rotatemod.Equals(EnumFitsValue.Allowed)) { rm = getAllowedRotateMod(); } else { rm = getPresentRotateMod(); } double a = matrix.A; double b = matrix.B; double c = matrix.C; double d = matrix.D; if ((a * d - b * c) == 0) { return(false); } double param = a / Math.Sqrt(Math.Abs(a * d - b * c)); if (((param - JDFBaseDataTypes_Fields.EPSILON) > 1) || ((param + JDFBaseDataTypes_Fields.EPSILON) < -1)) { return(false); } if (param > 1) { param = param - JDFBaseDataTypes_Fields.EPSILON; } if (param < -1) { param = param + JDFBaseDataTypes_Fields.EPSILON; } double fi = Math.Acos(param) * 180 / Math.PI; //0~180 double result = (fi + JDFBaseDataTypes_Fields.EPSILON) - (rm * (int)((fi + JDFBaseDataTypes_Fields.EPSILON) / rm)); double result180 = (fi + 180 + JDFBaseDataTypes_Fields.EPSILON) - (rm * (int)((fi + 180 + JDFBaseDataTypes_Fields.EPSILON) / rm)); return((Math.Abs(result) <= 2 * JDFBaseDataTypes_Fields.EPSILON) || (Math.Abs(result180) <= 2 * JDFBaseDataTypes_Fields.EPSILON)); }
/// /// <summary> * fitsValueMod - checks whether <code>rangelist</code> matches /// * AllowedValueMod/PresentValueMod, specified for this State /// * </summary> /// * <param name="rangelist"> /// * range list to test </param> /// * <param name="valuemod"> /// * switches between AllowedValueMod and PresentValueMod. /// * </param> /// * <returns> boolean - true, if <code>rangelist</code> matches the /// * <code>valuemod</code> or if AllowedValueMod is not specified </returns> /// private bool fitsValueMod(JDFIntegerRangeList rangelist, EnumFitsValue valuemod) { if (valuemod.Equals(EnumFitsValue.Allowed)) { if (!hasAttribute(AttributeName.ALLOWEDVALUEMOD)) { return(true); } } else { if (!hasAttribute(AttributeName.ALLOWEDVALUEMOD) && !hasAttribute(AttributeName.PRESENTVALUEMOD)) { return(true); } } JDFXYPair mod; if (valuemod.Equals(EnumFitsValue.Allowed)) { mod = getAllowedValueMod(); } else { mod = getPresentValueMod(); } int divi = (int)(mod.X + 0.5); // X - the Modulo int shift = (int)(mod.Y + 0.5); // Y - offset of the // allowed/present value if (divi == 0) // ValueMod can't be "0 x" { return(false); } JDFIntegerList v = rangelist.getIntegerList(); int[] vi = v.getIntArray(); int siz = vi.Length; for (int i = 0; i < siz; i++) { if ((((vi[i] % divi) - shift) % divi) != 0) { return(false); } } return(true); }
/// /// <summary> * fitsValueList - tests, if the defined 'rangelist' matches the /// * AllowedValueList or in the PresentValueList, specified for this State /// * </summary> /// * <param name="rangelist"> /// * range list to test </param> /// * <param name="valuelist"> /// * switches between AllowedValueList and PresentValueList. /// * </param> /// * <returns> boolean - true, if 'rangelist' matches the valuelist or if /// * AllowedValueList is not specified </returns> /// private bool fitsValueList(JDFDurationRangeList rangelist, EnumFitsValue valuelist) { JDFDurationRangeList list; if (valuelist.Equals(EnumFitsValue.Allowed)) { list = getAllowedValueList(); } else { list = getPresentValueList(); } if (list == null) { return(true); } EnumListType listType = getListType(); if (listType.Equals(EnumListType.CompleteList)) { return(fitsCompleteList(rangelist, list)); } else if (listType.Equals(EnumListType.CompleteOrderedList)) { return(fitsCompleteOrderedList(rangelist, list)); } else if (listType.Equals(EnumListType.ContainedList)) { return(fitsContainedList(rangelist, list)); } return(list.isPartOfRange(rangelist)); }
/// /// <summary> * fitsValueElem - tests, if JDFMatrix <code>matrix</code> matches /// * subelement Value, specified for this State /// * </summary> /// * <param name="matrix"> /// * JDFMatrix to test </param> /// * <param name="valuelist"> /// * switches between Allowed and Present configuration in /// * subelement Value. /// * </param> /// * <returns> boolean - true, if <code>matrix</code> matches subelement Value </returns> /// private bool fitsValueElem(JDFMatrix matrix, EnumFitsValue valuelist) { VElement v = getChildElementVector(ElementName.VALUE, null, null, true, 0, false); int siz = v.Count; bool hasValue = false; for (int i = 0; i < siz; i++) { JDFValue elm = (JDFValue)v[i]; if (elm.hasAttribute(AttributeName.VALUEUSAGE)) { EnumFitsValue valueUsage = getValueValueUsage(i); if (valuelist.Equals(valueUsage)) { hasValue = true; JDFMatrix @value = getValueAllowedValue(i); if (@value.Equals(matrix)) { return(true); // we have found it } } } else { hasValue = true; JDFMatrix @value = getValueAllowedValue(i); if (@value.Equals(matrix)) { return(true); // we have found it } } } return(!hasValue); // if no matching, there was no filter }
/// /// <summary> * fitsValueDurationList - tests, if the duration of the defined /// * <code>rangelist</code> value matchest the ValueDurationList, specified /// * for this State /// * </summary> /// * <param name="rangelist"> /// * range list to test </param> /// * <param name="valuelist"> /// * switches between AllowedValueList and PresentValueList </param> /// * <returns> boolean - true, if the duration of the defined rangelist is in /// * <code>valueList</code> or if ValueDurationList is not specified </returns> /// private bool fitsValueDurationList(JDFDateTimeRangeList rangelist, EnumFitsValue valuelist) { JDFDurationRangeList list; if (valuelist.Equals(EnumFitsValue.Allowed)) { list = getAllowedValueDurationList(); } else { list = getPresentValueDurationList(); } if (list == null) { return(true); } int siz = rangelist.Count; for (int i = 0; i < siz; i++) { JDFDateTimeRange range = (JDFDateTimeRange)rangelist[i]; int duration = (int)((range.Right.TimeInMillis - range.Left.TimeInMillis) / 1000); JDFDuration d = new JDFDuration(); d.setDuration(duration); if (!list.inRange(d)) { return(false); } } return(true); }
/// /// <summary> * fitsValueList - tests, if the defined 'value' matches the /// * AllowedValueList or the PresentValueList, specified for this State /// * </summary> /// * <param name="value"> /// * token to test </param> /// * <param name="valuelist"> /// * Switches between AllowedValueList and PresentValueList. </param> /// * <returns> boolean - true, if <code>value</code> matches valuelist, or if /// * AllowedValueList is not specified </returns> /// private bool fitsValueList(string @value, EnumFitsValue valuelist) { List <ValuedEnum> v; EnumBoolean eb = EnumBoolean.getEnum(@value); if (eb == null) { return(false); } if (valuelist.Equals(EnumFitsValue.Allowed)) { v = getAllowedValueList(); } else { v = getPresentValueList(); } if (v == null) { return(true); } return(v.Contains(eb)); }
/// /// <summary> * fitsValueElem - checks whether <code>pdfPath</code> matches the /// * subelement <code>Value</code> specified for this State /// * </summary> /// * <param name="pdfPath"> /// * PDFPath to test </param> /// * <param name="valueusage"> /// * switches between Allowed and Present configuration in /// * subelement <code>Value</code>. /// * </param> /// * <returns> boolean - true, if <code>pdfPath</code> matches subelement /// * <code>Value</code> </returns> /// private bool fitsValueElem(string pdfPath, EnumFitsValue valuelist) { VElement v = getChildElementVector(ElementName.VALUE, null, null, true, 0, false); int siz = v.Count; bool hasValue = false; for (int i = 0; i < siz; i++) { JDFValue elm = (JDFValue)v[i]; if (elm.hasAttribute(AttributeName.VALUEUSAGE)) { EnumFitsValue valueUsage = getValueValueUsage(i); if (valuelist.Equals(valueUsage)) { hasValue = true; string @value = getValueAllowedValue(i); if (@value.CompareTo(pdfPath) == 0) { return(true); // we have found it } } } else { hasValue = true; string @value = getValueAllowedValue(i); if (@value.CompareTo(pdfPath) == 0) { return(true); // we have found it } } } return(!hasValue); }
/// /// <summary> * fitsValueList - checks whether <code>value</code> matches the /// * AllowedValueList/PresentValueList specified for this State /// * </summary> /// * <param name="value"> /// * nmtokens to test </param> /// * <param name="valuelist"> /// * switches between AllowedValueList and PresentValueList. </param> /// * <returns> boolean - true, if <code>value</code> matches /// * <code>valuelist</code> or if AllowedValueList is not specified </returns> /// private bool fitsValueList(string @value, EnumFitsValue valuelist) { VString list; if (valuelist.Equals(EnumFitsValue.Allowed)) { list = getAllowedValueList(); } else { list = getPresentValueList(); } if (list == null) { return(true); } VString vs = new VString(@value, null); EnumListType listType = getListType(); if (listType.Equals(EnumListType.CompleteList)) { return(fitsCompleteList(vs, list)); } else if (listType.Equals(EnumListType.CompleteOrderedList)) { return(fitsCompleteOrderedList(vs, list)); } else if (listType.Equals(EnumListType.ContainedList)) { return(fitsContainedList(vs, list)); } int v_size = vs.Count; int l_size = list.Count; for (int i = 0; i < v_size; i++) // test every token, that 'value' // consists of { bool bFound = false; for (int j = 0; j < l_size; j++) { string ve = vs[i]; string le = list[j]; if (ve.CompareTo(le) == 0) { bFound = true; break; } } if (!bFound) { return(false); // no such value in the 'list' } } return(true); }
/// /// <summary> * fitsValueList - checks whether <code>rangelist</code> matches the /// * AllowedValueList/PresentValueList, specified for this State /// * </summary> /// * <param name="rangelist"> /// * range list to test </param> /// * <param name="valuelist"> /// * switches between AllowedValueList and PresentValueList /// * </param> /// * <returns> boolean - true, if <code>rangelist</code> matches the valuelist /// * or if AllowedValueList is not specified </returns> /// private bool fitsValueList(JDFIntegerRangeList rangelist, EnumFitsValue valuelist) { JDFIntegerRangeList list = null; if (valuelist.Equals(EnumFitsValue.Allowed)) { list = getAllowedValueList(); } else { list = getPresentValueList(); } if (list == null) { return(true); } EnumListType listType = getListType(); if (listType.Equals(EnumListType.CompleteList)) { return(fitsCompleteList(rangelist, list)); } else if (listType.Equals(EnumListType.CompleteOrderedList)) { return(fitsCompleteOrderedList(rangelist, list)); } else if (listType.Equals(EnumListType.ContainedList)) { return(fitsContainedList(rangelist, list)); } int siz = rangelist.Count; for (int i = 0; i < siz; i++) { JDFIntegerRange range = (JDFIntegerRange)rangelist[i]; // if range looks like"0~-1" but no xdef, then we assume that // xdef=lastIntegerInList int lastInList = ((JDFIntegerRange)list[list.Count - 1]).Right; int leftInRange = range.Left; int rightInRange = range.Right; if (lastInList > 0 && ((rightInRange < 0 && Math.Abs(rightInRange) < lastInList) || (leftInRange < 0 && Math.Abs(leftInRange) < lastInList))) { range.setDef(lastInList); } if (!list.isPartOfRange(range)) { return(false); } } return(true); }
/// /// <summary> * fitsShift - checks whether <code>matrix</code> matches the AllowedShift /// * or PresentShift specified for this State /// * </summary> /// * <param name="matrix"> /// * matrix to test </param> /// * <param name="shift"> /// * switches between AllowedShift and PresentShift. </param> /// * <returns> boolean - true, if <code>matrix</code> matches the Shift or if /// * AllowedShift is not specified </returns> /// private bool fitsShift(JDFMatrix matrix, EnumFitsValue shift) { if (shift == null || shift.Equals(EnumFitsValue.Allowed)) { if (!hasAttribute(AttributeName.ALLOWEDSHIFT)) { return(true); } } else { if (!hasAttribute(AttributeName.ALLOWEDSHIFT) && !hasAttribute(AttributeName.PRESENTSHIFT)) { return(true); } } JDFRectangle shiftValue; if (shift == null || shift.Equals(EnumFitsValue.Allowed)) { shiftValue = new JDFRectangle(getAllowedShift()); } else { shiftValue = new JDFRectangle(getPresentShift()); } double minTx = shiftValue.Llx; double minTy = shiftValue.Lly; double maxTx = shiftValue.Urx; double maxTy = shiftValue.Ury; double Tx = matrix.Tx; double Ty = matrix.Ty; return((Tx >= minTx) && (Tx <= maxTx) && (Ty >= minTy) && (Ty <= maxTy)); }
/// /// <summary> * fitsValueList - checks whether <code>rangelist</code> matches the /// * AllowedValueList/PresentValueList specified for this State /// * </summary> /// * <param name="rangelist"> /// * range list to test </param> /// * <param name="valuelist"> /// * switches between AllowedValueList and PresentValueList. /// * </param> /// * <returns> boolean - true, if <code>rangelist</code> matches the valuelist /// * or if AllowedValueList is not specified </returns> /// private bool fitsValueList(JDFNumberRangeList rangelist, EnumFitsValue valuelist) { JDFNumberRangeList list; if (valuelist.Equals(EnumFitsValue.Allowed)) { list = getAllowedValueList(); } else { list = getPresentValueList(); } if (list == null) { return(true); } EnumListType listType = getListType(); if (listType.Equals(EnumListType.CompleteList)) { return(fitsCompleteList(rangelist, list)); } else if (listType.Equals(EnumListType.CompleteOrderedList)) { return(fitsCompleteOrderedList(rangelist, list)); } else if (listType.Equals(EnumListType.ContainedList)) { return(fitsContainedList(rangelist, list)); } int siz = rangelist.Count; for (int i = 0; i < siz; i++) { JDFNumberRange range = (JDFNumberRange)rangelist[i]; if (!list.isPartOfRange(range)) { return(false); } } return(true); }
/// /// <summary> * fitsLength - tests, if the defined String <code>str</code> matches /// * AllowedLength or the PresentLength, specified for this State /// * </summary> /// * <param name="str"> /// * string to test </param> /// * <param name="length"> /// * switches between AllowedLength and PresentLength. </param> /// * <returns> boolean - true, if 'str' matches Length or if AllowedLength is /// * not specified </returns> /// protected internal bool fitsLength(string str, EnumFitsValue length) { JDFIntegerRange lengthlist; if (length.Equals(EnumFitsValue.Allowed)) { lengthlist = getAllowedLength(); } else { lengthlist = getPresentLength(); } if (lengthlist != null) { int len = str.Length; return(lengthlist.inRange(len)); } return(true); }
/// /// <summary> * fitsRegExp - checks whether <code>str</code> matches the /// * AllowedRegExp/PresentRegExp specified for this State /// * </summary> /// * <param name="str"> /// * string to test </param> /// * <param name="regexp"> /// * switches between AllowedRegExp and PresentRegExp. </param> /// * <returns> boolean - true, if <code>str</code> matches the RegExp or if /// * AllowedRegExp is not specified </returns> /// protected internal bool fitsRegExp(string str, EnumFitsValue regexp) { string rExp; if (regexp.Equals(EnumFitsValue.Allowed)) { rExp = getAllowedRegExp(); } else { rExp = getPresentRegExp(); } if (rExp.Length == 0) { return(true); // if AllowedRegExp is not specified return true } if (!StringUtil.matches(str, rExp)) { return(false); } return(true); }
/// /// <summary> * fitsXYRelation - checks whether <code>xypair</code> value matches the /// * AllowedXYRelation/PresentXYRelation specified for this State /// * </summary> /// * <param name="xypair"> /// * xypair to test </param> /// * <param name="xyrelation"> /// * switches between AllowedXYRelation and PresentXYRelation. </param> /// * <returns> boolean - true, if the <code>xypair</code> matches xyrelation or /// * if AllowedXYRelation is not specified </returns> /// private bool fitsXYRelation(JDFXYPair xypair, EnumFitsValue xyrelation) { EnumXYRelation relation; if (xyrelation.Equals(EnumFitsValue.Allowed)) { relation = getAllowedXYRelation(); } else { relation = getPresentXYRelation(); } if (relation == null) { return(true); } double x = xypair.X; double y = xypair.Y; return(relation.evaluateXY(x, y, JDFBaseDataTypes_Fields.EPSILON, JDFBaseDataTypes_Fields.EPSILON)); }
/// /// <summary> * fitsHWRelation - checks whether <code>rect</code> matches the /// * AllowedHWRelation/PresentHWRelation specified for this State /// * </summary> /// * <param name="rect"> /// * rectangle value to test </param> /// * <param name="hwrelation"> /// * Switches between AllowedHWRelation and PresentHWRelation. </param> /// * <returns> boolean - true, if <code>rect</code> matches hwrelation or if /// * AllowedHWRelation is not specified </returns> /// private bool fitsHWRelation(JDFRectangle rect, EnumFitsValue hwrelation) { EnumXYRelation relation; if (hwrelation.Equals(EnumFitsValue.Allowed)) { relation = getAllowedHWRelation(); } else { relation = getPresentHWRelation(); } if (relation == null) { return(true); } double width = rect.Urx - rect.Llx; double height = rect.Ury - rect.Lly; return(relation.evaluateXY(width, height, JDFBaseDataTypes_Fields.EPSILON, JDFBaseDataTypes_Fields.EPSILON)); }
/// /// <summary> * fitsValueMod - checks whether <code>range</code> matches the /// * <code>ValueMod</code> specified for this State. /// * </summary> /// * <param name="rangelist"> /// * range list to test </param> /// * <param name="valuemod"> /// * switches between AllowedValueMod and PresentValueMod. /// * </param> /// * <returns> boolean - true, if <code>rangelist</code> matches the valuemod or /// * if AllowedValueMod is not specified </returns> /// private bool fitsValueMod(JDFNumberRangeList rangelist, EnumFitsValue valuemod) { if (valuemod.Equals(EnumFitsValue.Allowed)) { if (!hasAttribute(AttributeName.ALLOWEDVALUEMOD)) { return(true); } } else { if (!hasAttribute(AttributeName.ALLOWEDVALUEMOD) && !hasAttribute(AttributeName.PRESENTVALUEMOD)) { return(true); } } JDFXYPair mod; if (valuemod.Equals(EnumFitsValue.Allowed)) { mod = getAllowedValueMod(); } else { mod = getPresentValueMod(); } int size = rangelist.Count; for (int i = 0; i < size;) { JDFNumberRange range = (JDFNumberRange)rangelist[i]; double left = range.Left; double right = range.Right; if (left != right) // if we have a range return false, check only // single value { return(false); } double elem = left; // single value double divi = mod.X; // X - the Modulo double shift = mod.Y; // Y - offset of the allowed/present // value if (divi == 0) { return(false); } // if ValueMod is not "0 x" double n = ((elem - divi * (int)(elem / divi)) - shift); // n = // elem // % // divi // - // shift if (Math.Abs(n) < JDFBaseDataTypes_Fields.EPSILON * Math.Abs(divi)) { return(true); } double m = (n - divi * (int)(n / divi)); // m = ( elem % divi - // shift ) % divi if (Math.Abs(m) < JDFBaseDataTypes_Fields.EPSILON * Math.Abs(divi)) { return(true); } return(false); } return(true); }
/// /// <summary> * fitsXYZ - checks whether <code>rangelist</code> matches the (AllowedX, /// * AllowedY, AllowedZ) or (PresentX, PresentY, PresentZ) values specified /// * for this State /// * </summary> /// * <param name="rangelist"> /// * range list to test </param> /// * <param name="xyzlist"> /// * switches between (AllowedX, AllowedY, AllowedZ) and (PresentX, /// * PresentY, PresentZ). </param> /// * <returns> boolean - true, if the 'rangelist' matches xyzlist or if /// * AllowedX, AllowedY, AllowedZ are not specified </returns> /// private bool fitsXYZ(JDFShapeRangeList rangelist, EnumFitsValue xyzlist) { int siz = rangelist.Count; for (int i = 0; i < siz; i++) { JDFShapeRange range = (JDFShapeRange)rangelist[i]; JDFNumberRangeList x, y, z; JDFShape left = range.Left; JDFShape right = range.Right; double leftX = left.Y; double rightX = right.Y; JDFNumberRange rangeX = new JDFNumberRange(leftX, rightX); double leftY = left.X; double rightY = right.X; JDFNumberRange rangeY = new JDFNumberRange(leftY, rightY); double leftZ = left.Z; double rightZ = right.Z; JDFNumberRange rangeZ = new JDFNumberRange(leftZ, rightZ); if (xyzlist.Equals(EnumFitsValue.Allowed)) { x = getAllowedX(); y = getAllowedY(); z = getAllowedZ(); } else { x = getPresentX(); y = getPresentY(); z = getPresentZ(); } bool bFit = true; if (x.Count != 0) { bFit = x.isPartOfRange(rangeX); } if (!bFit) { return(false); } if (y.Count != 0) { bFit = y.isPartOfRange(rangeY); } if (!bFit) { return(false); } if (z.Count != 0) { bFit = z.isPartOfRange(rangeZ); } if (!bFit) { return(false); } } return(true); }
/// /// <summary> * fitsTransforms - checks whether <code>matrix</code> matches the /// * AllowedTransforms or PresentTransforms, specified for this State /// * </summary> /// * <param name="matrix"> /// * matrix to test </param> /// * <param name="transforms"> /// * switches between AllowedTransforms and PresentTransforms. </param> /// * <returns> boolean - true, if <code>matrix</code> matches the Transforms or /// * if AllowedTransforms is not specified </returns> /// private bool fitsTransforms(JDFMatrix matrix, EnumFitsValue transforms) { if (transforms == null || transforms.Equals(EnumFitsValue.Allowed)) { if (!hasAttribute(AttributeName.ALLOWEDTRANSFORMS)) { return(true); } } else { if (!hasAttribute(AttributeName.ALLOWEDTRANSFORMS) && !hasAttribute(AttributeName.PRESENTTRANSFORMS)) { return(true); } } double nT = JDFBaseDataTypes_Fields.EPSILON; // negative tolerance double pT = JDFBaseDataTypes_Fields.EPSILON; // positive tolerance double a = matrix.A; double b = matrix.B; double c = matrix.C; double d = matrix.D; double det = (a * d - b * c); if (det == 0) { return(false); } a = a / Math.Sqrt(Math.Abs(det)); b = b / Math.Sqrt(Math.Abs(det)); c = c / Math.Sqrt(Math.Abs(det)); d = d / Math.Sqrt(Math.Abs(det)); List <ValuedEnum> vTransf; if (transforms == null || transforms.Equals(EnumFitsValue.Allowed)) { vTransf = getAllowedTransforms(); } else { vTransf = getPresentTransforms(); } int siz = vTransf.Count; for (int i = 0; i < siz; i++) { EnumOrientation orientation = (EnumOrientation)vTransf[i]; if (orientation.Equals(EnumOrientation.Flip0)) // a=1 b=0 c=0 d=-1 { if ((a - 1 < pT) && (a - 1 > -nT) && (b < pT) && (b > -nT) && (c < pT) && (c > -nT) && (d + 1 < pT) && (d + 1 > -nT)) { return(true); } continue; } // a=0 b=-1 else if (orientation.Equals(EnumOrientation.Flip90)) // c=-1 d=0 { if ((a < pT) && (a > -nT) && (b + 1 < pT) && (b + 1 > -nT) && (c + 1 < pT) && (c + 1 > -nT) && (d < pT) && (d > -nT)) { return(true); } continue; } // a=-1 b=0 else if (orientation.Equals(EnumOrientation.Flip180)) // c=0 d=1 { if ((a + 1 < pT) && (a + 1 > -nT) && (b < pT) && (b > -nT) && (c < pT) && (c > -nT) && (d - 1 < pT) && (d - 1 > -nT)) { return(true); } continue; } // a=0 b=1 else if (orientation.Equals(EnumOrientation.Flip270)) // c=1 d=0 { if ((a < pT) && (a > -nT) && (b - 1 < pT) && (b - 1 > -nT) && (c - 1 < pT) && (c - 1 > -nT) && (d < pT) && (d > -nT)) { return(true); } continue; } // a=1 b=0 else if (orientation.Equals(EnumOrientation.Rotate0)) // c=0 d=1 { if ((a - 1 < pT) && (a - 1 > -nT) && (b < pT) && (b > -nT) && (c < pT) && (c > -nT) && (d - 1 < pT) && (d - 1 > -nT)) { return(true); } continue; } // a=0 b=1 else if (orientation.Equals(EnumOrientation.Rotate90)) // c=-1 // d=0 { if ((a < pT) && (a > -nT) && (b - 1 < pT) && (b - 1 > -nT) && (c + 1 < pT) && (c + 1 > -nT) && (d < pT) && (d > -nT)) { return(true); } continue; } // a=-1 else if (orientation.Equals(EnumOrientation.Rotate180)) // b=0 // c=0 // d=-1 { if ((a + 1 < pT) && (a + 1 > -nT) && (b < pT) && (b > -nT) && (c < pT) && (c > -nT) && (d + 1 < pT) && (d + 1 > -nT)) { return(true); } continue; } // a=0 else if (orientation.Equals(EnumOrientation.Rotate270)) // b=-1 // c=1 // d=0 { if ((a < pT) && (a > -nT) && (b + 1 < pT) && (b + 1 > -nT) && (c - 1 < pT) && (c - 1 > -nT) && (d < pT) && (d > -nT)) { return(true); } continue; } else { return(true); } } return(false); }