/* * Convert A LFN Filename to a 8.3 filename * * IN: * pLfnName : Name of an ext2 directory entry * EntryLen : Length of bytes of pLfnName * * OUT: * ShortName : ASCIIZ 8.3 filename * */ void LfnToShortName(char *EntryName, int EntryLen, char *ShortName, int Offset) { USHORT uni_lfn[MAX_PATH]; USHORT uni_short[14]; _QWORD qword; DWORD rval; /* * Convert to Unicode Short FileName, make sure we do not * convert . or .. */ if (isDotOrDotDot(EntryName, EntryLen)) { strncpy(ShortName, EntryName, EntryLen); ShortName[EntryLen] = 0; } else { /* * Convert BCS LFN to Unicode LFN FileName */ BCSToUni(uni_lfn, EntryName, EntryLen, BCS_OEM, &qword); uni_lfn[qword.ddLower >> 1] = 0; /* * Create the Unicode 8.3 name */ rval = CreateBasis(uni_short, uni_lfn, qword.ddLower); if (rval & (BASIS_LOSS | BASIS_UPCASE | BASIS_TRUNC)) AppendBasisTail(uni_short, (INT) Offset%100); /* * Convert to BCS */ UniToBCS(ShortName, uni_short, 2 * ustrlen(uni_short), 12, BCS_OEM, &qword); ShortName[qword.ddLower] = 0; } }
bool ViewerQuery::UpdateLineFromSlice(PlaneAttributes *newPlaneAtts) { // // Only update the line if the slice-plane attributes have truly changed. // if (*planeAtts == *newPlaneAtts) return false; int i, opId = -1; int lineId = resultsPlot->GetNOperators()-1; for (i = 0; i < lineId; i++) { ViewerOperator *oper = resultsPlot->GetOperator(i); if (strcmp(oper->GetName(), "Slice") == 0) { opId = i; break; } } // // No need to update if no slice-operator has been applied. // if (opId == -1) return false; avtVector pt1(lineAtts->GetPoint1()); avtVector pt2(lineAtts->GetPoint2()); avtVector o1(planeAtts->GetOrigin()); avtVector o2(newPlaneAtts->GetOrigin()); // Define the frame for Plane 1. avtVector P1N(planeAtts->GetNormal()); avtVector P1Up(planeAtts->GetUpAxis()); avtVector u1, v1, w1; CreateBasis(P1N, P1Up, u1, v1, w1); // Define the frame for Plane 2. avtVector P2N(newPlaneAtts->GetNormal()); avtVector P2Up(newPlaneAtts->GetUpAxis()); avtVector u2, v2, w2; CreateBasis(P2N, P2Up, u2, v2, w2); avtMatrix M1, M2, M3, C; int spaceT = 0; if (planeAtts->GetThreeSpace() && !newPlaneAtts->GetThreeSpace()) { // convert 3d to 2d avtVector zero(0., 0., 0.); avtMatrix C1, C2; C1.MakeFrameToCartesianConversion(u2, v2, w2, zero); C1.Inverse(); C2.MakeScale(1, 1, 0); C = C2 * C1; spaceT = 1; } else if (!planeAtts->GetThreeSpace() && newPlaneAtts->GetThreeSpace()) { // convert 2d to 3d avtVector zero(0., 0., 0.); avtMatrix C1, C2, C3; C1.MakeFrameToCartesianConversion(u1, v1, w1, zero); C2.MakeCartesianToFrameConversion(u1, v1, w1, zero); avtVector zdim = C1 * o1; zdim.x = 0; zdim.y = 0; zdim = C2 * zdim; C3.MakeTranslate(zdim.x, zdim.y, zdim.z); C = C3 * C1; spaceT = 2; } if ((!planeAtts->FieldsEqual(0, newPlaneAtts)) || (!planeAtts->FieldsEqual(1, newPlaneAtts)) || (!planeAtts->FieldsEqual(2, newPlaneAtts))) { // Create conversion between Cartesian and plane1 frame. M1.MakeCartesianToFrameConversion(u1, v1, w1, o1); // Create conversion between plane2 and Cartesian frame. M2.MakeFrameToCartesianConversion(u2, v2, w2, o2); // Create composition matrix. switch (spaceT) { case 0 : M3 = M2 * M1; break; // no dimensionality change case 1 : M3 = C * M2 * M1; break; // converted from 3d to 2d case 2 : M3 = M2 * M1 * C; break; // converted from 2d to 3d } } else { M3 = C; } // Convert points. pt1 = M3 * pt1; pt2 = M3 * pt2; // Update necessary attributes. lineAtts->SetPoint1(pt1.x, pt1.y, pt1.z); lineAtts->SetPoint2(pt2.x, pt2.y, pt2.z); *planeAtts = *newPlaneAtts; // Ensure that both the slice and lineout operators have the correct atts. resultsPlot->GetOperator(lineId)->SetOperatorAtts(lineAtts); resultsPlot->GetOperator(opId)->SetOperatorAtts(newPlaneAtts); // Update the refline. originatingWindow->UpdateQuery(lineAtts); return true; }