~ubuntu-branches/ubuntu/vivid/electric/vivid

« back to all changes in this revision

Viewing changes to com/sun/electric/technology/AbstractShapeBuilder.java

  • Committer: Package Import Robot
  • Author(s): Markus Koschany
  • Date: 2014-07-08 21:54:23 UTC
  • mfrom: (1.1.6) (3.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20140708215423-4zrgsca1e28tzcoc
Tags: 9.05+dfsg-1
* Imported Upstream version 9.05+dfsg.
* Add signing-key.pgp and check for valid upstream tarballs with uscan's
  pgpsigurlmangle feature.
* Move the package to Git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1157
1157
            long cutAreaHeight = hy - ly;
1158
1158
 
1159
1159
            // number of cuts depends on the size of cut area
1160
 
            int oneDcutsX = 1 + (int) (cutAreaWidth / (cutSizeX + cutSep1D));
1161
 
            int oneDcutsY = 1 + (int) (cutAreaHeight / (cutSizeY + cutSep1D));
1162
 
 
 
1160
            // It is always allowed 1 since it should be valid by construction.
 
1161
            int oneDcutsX = getNumCutsAlong(cutAreaWidth, cutSizeX, cutSep1D);
 
1162
            int oneDcutsY = getNumCutsAlong(cutAreaHeight, cutSizeY, cutSep1D);
 
1163
            
1163
1164
            // check if configuration gives 2D cuts
1164
1165
            cutSep = cutSep1D;
1165
1166
            cutsX = oneDcutsX;
1166
1167
            cutsY = oneDcutsY;
1167
1168
            if (cutsX > 1 && cutsY > 1) {
1168
1169
                // recompute number of cuts for 2D spacing
1169
 
                int twoDcutsX = 1 + (int) (cutAreaWidth / (cutSizeX + cutSep2D));
1170
 
                int twoDcutsY = 1 + (int) (cutAreaHeight / (cutSizeY + cutSep2D));
 
1170
                int twoDcutsX= getNumCutsAlong(cutAreaWidth, cutSizeX, cutSep2D);
 
1171
                int twoDcutsY = getNumCutsAlong(cutAreaHeight, cutSizeY, cutSep2D);
 
1172
                
1171
1173
                cutSep = cutSep2D;
1172
1174
                cutsX = twoDcutsX;
1173
1175
                cutsY = twoDcutsY;
 
1176
                
1174
1177
                if (cutsX == 1 || cutsY == 1) {
1175
1178
                    // 1D separation sees a 2D grid, but 2D separation sees a linear array: use 1D linear settings
1176
1179
                    cutSep = cutSep1D;
1237
1240
            }
1238
1241
        }
1239
1242
 
1240
 
//        /**
1241
 
//         * Method to return the number of cuts in the contact node.
1242
 
//         * @return the number of cuts in the contact node.
1243
 
//         */
1244
 
//        private int numCuts() {
1245
 
//            return cutsTotal;
1246
 
//        }
1247
 
//
1248
 
//        /**
1249
 
//         * Method to return the number of cuts along X axis in the contact node.
1250
 
//         * @return the number of cuts in the contact node along X axis.
1251
 
//         */
1252
 
//        private int numCutsX() {
1253
 
//            return cutsX;
1254
 
//        }
1255
 
//
1256
 
//        /**
1257
 
//         * Method to return the number of cuts along Y axis in the contact node.
1258
 
//         * @return the number of cuts in the contact node along Y axis.
1259
 
//         */
1260
 
//        private int numCutsY() {
1261
 
//            return cutsY;
1262
 
//        }
1263
 
//
1264
 
//        /**
1265
 
//         * Method to return the size of the cut along X.
1266
 
//         */
1267
 
//        private double getCutSizeX() {
1268
 
//            return cutSizeX;
1269
 
//        }
1270
 
//
1271
 
//        /**
1272
 
//         * Method to return the size of the cut along Y.
1273
 
//         */
1274
 
//        private double getCutSizeY() {
1275
 
//            return cutSizeY;
1276
 
//        }
 
1243
        private int getNumCutsAlong(long cutArea, long cutSize, long cutSep)
 
1244
        {
 
1245
            int cuts = 1 + (int) (cutArea / (cutSize + cutSep));
 
1246
            // checking if remainder is bigger that cutSizeX/Y
 
1247
//            long reminder = cutArea % (cutSize + cutSep);
 
1248
//            // if not enough -> one less
 
1249
//            if (reminder < cutSize)
 
1250
//              cuts--;
 
1251
            if (cuts == 0 && cutArea == 0)
 
1252
                cuts = 1; // force one at least 
 
1253
            return cuts;
 
1254
        }
1277
1255
 
1278
1256
        /**
1279
1257
         * Method to fill in the contact cuts based on anchor information.