项目:chordatlas
文件:SSBuilder.java
private void opt (SolverState solverState) {
new Thread() {
@Override
public void run() {
File result = new File (Tweed.SCRATCH + "solver_state.xml");
SkelFootprint.solve( solverState,new ProgressMonitor( null,"optimising",result.getName(),100 ),result,Long.MAX_VALUE );
SkelFootprint.postProcesss( solverState );
// profileGen.tweed.frame.removeGens( SkelGen.class );
profileGen.tweed.frame.addGen( new SkelGen( solverState.mesh,profileGen.tweed,profileGen.blockGen ),true );
}
}.start();
}
项目:modeller
文件:BagView.java
/**
* statusBarBegin.
*
* @param progress Progress
* @param message String
* @param activityMonitored String
*/
public void statusBarBegin(final Progress progress,final String message,final String activityMonitored) {
BusyIndicator.showAt(Application.instance().getActiveWindow().getControl());
task = new LongTask();
task.setActivityMonitored(activityMonitored);
task.setProgress(progress);
timer.addActionListener(new TimerListener());
progressMonitor =
new ProgressMonitor(this.getControl(),message,"Preparing the " + "operation...",1);
progressMonitor.setMillisToDecidetoPopup(ONE_SECOND);
task.setMonitor(progressMonitor);
task.go();
timer.start();
}
项目:pumpernickel
文件:JPEGMovWriter.java
/** Add all the frames from an AnimationReader.
*
* @param r the animation to read.
* @param monitor an optional ProgressMonitor to update
* @throws IOException if an error occurs copying frames.
*/
public void addFrames(AnimationReader r,ProgressMonitor monitor) throws IOException {
if(monitor!=null)
monitor.setMaximum(r.getFrameCount());
BufferedImage bi = r.getNextFrame(false);
int ctr = 1;
while(bi!=null) {
if(monitor!=null) {
if(monitor.isCanceled()) {
throw new UserCancelledException();
}
monitor.setProgress(ctr);
}
float d;
try {
d = (float)r.getFrameDuration();
} catch(Exception e) {
e.printstacktrace();
d = 1;
}
addFrame(d,bi,.98f);
bi = r.getNextFrame(false);
ctr++;
}
}
项目:awake-file
文件:FileTransferProgressMonitorDemo.java
/**
* Invoked when the user presses the start button.
*/
public void actionPerformed(ActionEvent evt) {
progressMonitor = new ProgressMonitor(
FileTransferProgressMonitorDemo.this,"Uploads a file...","",100);
progressMonitor.setProgress(0);
Thread t = new Thread() {
public void run() {
doFileUpload();
}
};
t.start();
task = new Task();
task.addPropertychangelistener(this);
task.execute();
startButton.setEnabled(false);
}
项目:awake-file
文件:FileTransferProgressMonitorDownloadDemo.java
/**
* Invoked when the user presses the start button.
*/
public void actionPerformed(ActionEvent evt) {
progressMonitor = new ProgressMonitor(
FileTransferProgressMonitorDownloadDemo.this,"Downloads a file...",100);
progressMonitor.setProgress(0);
Thread t = new Thread() {
public void run() {
doFileDownload();
}
};
t.start();
task = new Task();
task.addPropertychangelistener(this);
task.execute();
startButton.setEnabled(false);
}
项目:nullpomino
文件:RanksResult.java
public RanksResult(JFrame parent,Ranks ranks,int bestNRanks,boolean ascendant){
super(parent,true);
//this.parent=parent;
this.bestNRanks=bestNRanks;
this.ranks=ranks;
this.setDefaultCloSEOperation(disPOSE_ON_CLOSE);
this.factorCompare=ascendant?-1:1;
this.maxJump=ranks.getMaxJump();
this.stackWidth=ranks.getStackWidth();
progressMonitor=new ProgressMonitor(parent,AIRanksTool.getUIText("Result_Progress_Message"),100);
progressMonitor.setProgress(0);
task = new Task();
task.addPropertychangelistener(this);
task.execute();
}
/**
* Cut the given surface with this CutPoint.
*
* @param surface Surface
* @param monitor progress monitor which can be canceled
*/
@Override
public synchronized void cutSurface(Surface surface,ProgressMonitor monitor) {
Vector2d cutVectorS = getPerpVector(cutDepth);
double x0 = getX() + cutVectorS.x; // cutter location with depth
double z0 = getZ() + cutVectorS.y;
int nSectors = surface.numSectors(); // number of sectors around shape
double dAngle = 360.0 / (double) nSectors; // angle increment degrees
Vector2d cutXZ; // Location of center of cutter
double spindleC,lastC = 0.0; // rotation in degrees
int count;
for (count = 0,spindleC = 0.0; count < nSectors; count++,spindleC += dAngle) {
cutXZ = RosetteMove(spindleC,x0,z0);
surface.rotateZ(spindleC - lastC); // incremental rotate the surface
if (cutter.canFastRender()) {
surface.cutSurface(cutter,cutXZ.x,cutXZ.y,spindleC);
} else {
surface.cutSurface(cutter,cutXZ.y);
}
lastC = spindleC;
}
surface.rotateZ(360.0 - lastC); // bring it back to the starting point
}
项目:COrnLathe
文件:PiercePoint.java
/**
* Cut the given surface with this CutPoint.
*
* @param surface Surface
* @param monitor progress monitor which can be canceled
*/
@Override
public synchronized void cutSurface(Surface surface,ProgressMonitor monitor) {
Vector2d cutVectorS = getMoveVector(cutDepth); // cut direction scaled by depth
double cutX = getX() + cutVectorS.x;
double cutZ = getZ() + cutVectorS.y;
int nSamples = surface.numSectors();
double spindleC,lastC = 0.0;
for (int i = 0; i < nSamples; i++) {
spindleC = 360.0 * (double) i / (double) nSamples;
surface.rotateZ(spindleC - lastC); // incremental rotate the surface
surface.cutSurface(cutter,cutX,cutZ,spindleC); // fast cut rendering
lastC = spindleC;
}
surface.rotateZ(360.0 - lastC); // bring it back to the starting point
}
项目:Animator
文件:FlashThread.java
@Override
public Void doInBackground() {
String rawString = configManager.getRawString();
try {
stream = new ProgressMonitorInputStream(null,(Object) "Flashing",new ByteArrayInputStream(rawString
.getBytes(HacklaceConfigManager.HACKLACE_CHARSET)));
ProgressMonitor progressMonitor = stream.getProgressMonitor();
progressMonitor.setMaximum(rawString.length());
progressMonitor.setProgress(0);
progressMonitor.setMillisToPopup(0);
animatorGui.setCursor(Cursor
.getPredefinedCursor(Cursor.WAIT_CURSOR));
flashExporter.write(stream);
} catch (Exception ex) {
JOptionPane.showMessageDialog(null,"Error flashing hacklace: "
+ ex,"Error",JOptionPane.ERROR_MESSAGE);
}
return null;
}
项目:File-UI
文件:MyProgressMonitor.java
public void init(int op,String src,String dest,long max) {
this.max = max;
monitor = new ProgressMonitor(null,((op == SftpProgressMonitor.PUT)
? "put" : "get") + ": " + src,(int) max);
count = 0;
percent = -1;
monitor.setProgress((int) this.count);
monitor.setMillisToDecidetoPopup(1000);
}
项目:wildfly-core
文件:DownloadServerLogDialog.java
@Override
public void actionPerformed(ActionEvent event) {
String path = pathField.getText();
if (path.trim().isEmpty()) {
JOptionPane.showMessageDialog(this,"A file path must be selected.","Empty File Path",JOptionPane.ERROR_MESSAGE);
return;
}
File selectedFile = new File(path);
if (selectedFile.exists()) {
this.setVisible(false);
int option = JOptionPane.showConfirmDialog(cliGuiCtx.getMainWindow(),"Overwrite " + path,"Overwrite?",JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.NO_OPTION) {
this.setVisible(true);
return;
}
}
this.dispose();
progressMonitor = new ProgressMonitor(cliGuiCtx.getMainWindow(),"Downloading " + fileName,100);
progressMonitor.setProgress(0);
downloadTask = new DownloadLogTask(selectedFile);
downloadTask.addPropertychangelistener(this);
downloadTask.execute();
}
项目:jClipCorn
文件:backupmanager.java
public void createBackup(Component c,String name,CCDate date,boolean persistent,String jccversion,String dbversion) {
if (CCProperties.getInstance().ARG_READONLY) {
cclog.add@R_389_4045@ion(LocaleBundle.getString("LogMessage.OperationFailedDuetoReadOnly")); //$NON-NLS-1$
return;
}
cclog.add@R_389_4045@ion(LocaleBundle.getString("LogMessage.BackupStarted")); //$NON-NLS-1$
ProgressMonitor monitor = DialogHelper.getLocalPersistentProgressMonitor(c,"MainFrame.backupRunning"); //$NON-NLS-1$
try {
createBackupInternal(name,date,persistent,jccversion,dbversion,new ProgressCallbackProgressMonitorHelper(monitor),false);
} catch (IOException e) {
cclog.addError(e);
monitor.setProgress(monitor.getMaximum());
monitor.close();
return;
}
monitor.setProgress(monitor.getMaximum());
monitor.close();
cclog.add@R_389_4045@ion(LocaleBundle.getString("LogMessage.BackupCreated")); //$NON-NLS-1$
CCProperties.getInstance().PROP_BACKUP_LASTBACKUP.setValue(CCDate.getCurrentDate());
}
项目:morenaments-euc
文件:Export.java
public boolean export(OutputStream out)
throws IOException,NoninvertibleTransformException {
this.out = out;
List lines = ornament.getLines();
int nLines = lines.size(),maxProgress = nLines + 2;
ProgressMonitor pm = new ProgressMonitor(ornament,I18n._("exporting"),null,maxProgress);
init();
prepareStream();
pm.setProgress(1);
head();
BufferedImage bg = ornament.getBackgroundTile();
if (bg != null) background(bg);
for (int i = 0; i != nLines && !pm.isCanceled(); ++i) {
pm.setProgress(2+i);
export((LinPath)lines.get(i));
}
pm.setProgress(2+nLines);
postBody();
tail();
if (out != null) out.close();
pm.close();
return true;
}
项目:vars
文件:SaveImagesFromQueryResultsAction.java
/**
* @see org.mbari.awt.event.IAction#doAction()
*/
public void doAction() {
/*
* Show dialog for selecting a directory
*/
int option = getChooser().showOpenDialog(queryResultsFrame);
if (option == JFileChooser.APPROVE_OPTION) {
action.setSaveLocation(getChooser().getSelectedFile());
URL[] urls = getimageURLs();
action.setUrls(urls);
action.setProgressMonitor(
new ProgressMonitor(queryResultsFrame,"Downloading images",urls.length));
ActionRunnable ar = new ActionRunnable(action);
ar.start();
}
}
项目:jmt
文件:LoadPanel.java
@Override
public Object construct() {
ProgressMonitor pm = new ProgressMonitor(own,msg,max);
pm.setMillisToDecidetoPopup(0);
pm.setMillisToPopup(0);
pm.setProgress(0);
return pm;
}
项目:chordatlas
文件:SkelFootprint.java
public static void solve( SolverState SS,ProgressMonitor m,File output,long timeLimitSec ) {
try {
new GurobiSkelSolver(SS,m,timeLimitSec ).solve();
}
catch (Throwable th) {
th.printstacktrace();
}
if ( output != null )
SS.copy( true ).save( output,false );
}
项目:chordatlas
文件:GurobiSkelSolver.java
public GurobiSkelSolver( SolverState ss,long maxTimeSecs ) {
this.ss = ss;
this.mesh = ss.mesh;
this.minis = ss.minis;
this.globalProfs = ss.globalProfs;
this.profFit = ss.profFit;
this.progress = m;
this.maxTimeSecs = maxTimeSecs;
}
项目:chordatlas
文件:SSBuilder.java
private SolverState preview(boolean finall) {
PaintThing.lookup.put( HalfMesh2.class,new SuperMeshPainter() );
PaintThing.debug.clear();
plot.toPaint.clear();
SkelFootprint sf = updateVars();
if (finall)
sf.exitA = false;
ProgressMonitor pm = new ProgressMonitor( null,"working","...",100 );
SolverState SS;
try {
SS = sf.buildFootprint(
profileGen.footprint,pm,features,profileGen.blockGen );
}
finally {
pm.close();
}
if (SS != null) {
System.out.println("done");
plot.toPaint.add( profileGen.blockGen.nameCoords() );
plot.toPaint.add( SS.mesh );
plot.toPaint.add( SS.miniPainter() );
}
else
PaintThing.debug(Color.red,1,"Bad state");
plot.repaint();
return SS;
}
项目:chordatlas
文件:SkelGen.java
public SkelGen( List<Line> footprint,Tweed tweed,BlockGen blockGen ) {
super( "model",tweed );
this.footprint = footprint;
this.blockGen = blockGen;
skelFootprint = new SkelFootprint(tweed);
ProgressMonitor m = new ProgressMonitor( tweed.frame(),"Optimizing",100 );
m.setProgress( 1 );
m.setMillisToPopup( 0 );
new Thread( () -> {
optimize(m);
SkelGen.this.calculateOnJmeThread(); } ).start();
}
项目:QN-ACTR-Release
文件:LoadPanel.java
@Override
public Object construct() {
ProgressMonitor pm = new ProgressMonitor(own,max);
pm.setMillisToDecidetoPopup(0);
pm.setMillisToPopup(0);
pm.setProgress(0);
return pm;
}
项目:Java-RPG-Maker-MV-Decrypter
文件:GUI.java
/**
* Invoked when an action occurs.
*
* @param e - ActionEvent
*/
@Override
public void actionPerformed(ActionEvent e) {
this.progressMonitor = new ProgressMonitor(mainWindow,"Decrypting...","Preparing...",this.files.size());
this.progressMonitor.setProgress(0);
this.execute();
}
项目:openjdk-jdk10
文件:ProgressMonitorEscapeKeyPress.java
public static void main(String[] args) throws Exception {
createTestUI();
monitor = new ProgressMonitor(frame,"Progress",100);
robotthread = new TestThread();
robotthread.start();
for (counter = 0; counter <= 100; counter += 10) {
Thread.sleep(1000);
EventQueue.invokeAndWait(new Runnable() {
@Override
public void run() {
if (!monitor.isCanceled()) {
monitor.setProgress(counter);
System.out.println("Progress bar is in progress");
}
}
});
if (monitor.isCanceled()) {
break;
}
}
disposeTestUI();
if (counter >= monitor.getMaximum()) {
throw new RuntimeException("Escape key did not cancel the ProgressMonitor");
}
}
项目:Logisim
文件:GifEncoder.java
MyGrabber(ProgressMonitor monitor,Image image,int x,int y,int width,int height,int[] values,int start,int scan) {
super(image,x,y,width,height,values,start,scan);
this.monitor = monitor;
progress = 0;
goal = width * height;
monitor.setMinimum(0);
monitor.setMaximum(goal * 21 / 20);
}
ExportThread(Frame frame,Canvas canvas,File dest,ImageFileFilter f,List<Circuit> circuits,double scale,boolean printerView,ProgressMonitor monitor) {
this.frame = frame;
this.canvas = canvas;
this.dest = dest;
this.filter = f;
this.circuits = circuits;
this.scale = scale;
this.printerView = printerView;
this.monitor = monitor;
}
public XMLPersister(OutputStream out,String rootObject,String projectTag,ProgressMonitor pm) {
bufferedOut = new ByteArrayOutputStream();
this.out = new PrintWriter(bufferedOut);
this.finalOut = out;
this.rootObject = rootObject;
this.pm = pm;
PROJECT_TAG = projectTag;
}
项目:Keel3.0
文件:PartitionCreator.java
private void handleDownloadStarted()
{
logDebug("handleDownloadStarted: launching progress monitor");
GUIUtils.processOnSwingEventThread(new Runnable()
{
public void run()
{
final JFrame frame = controller.getMainFrame();
progressMonitor =
new ProgressMonitor(frame,i18n.DOWNLOADING_UPDATES_MSG,totalFiles);
setProgress(0);
}
});
}
项目:KEEL
文件:PartitionCreator.java
项目:eurocarbdb
文件:GAGPlugin.java
private boolean runAnnotation() {
theThread.start();
// launch progress dialog
progressDialog = new ProgressMonitor(theApplication,"Matching peaks with fragments",theThread.getTarget());
// set up the timer action
activityMonitor = new Timer(200,new ActionListener() {
public void actionPerformed (ActionEvent event) {
int progress = theThread.getProgress();
// show progress
progressDialog.setProgress(progress);
// check if task is completed or canceled
if( progress==theThread.getTarget() || theThread.isInterrupted() || progressDialog.isCanceled ()) {
activityMonitor.stop();
progressDialog.close();
if( progress!=theThread.getTarget() ) {
theThread.interrupt();
onAnnotationAborted(theThread);
}
else {
onAnnotationCompleted(theThread);
}
}
}
});
activityMonitor.start();
// return control
return true;
}
项目:eurocarbdb
文件:AnnotationPlugin.java
public boolean scanAnnotationCascade(boolean ask,Vector<Scan> parentScans) {
if(setAnnotationoptions(ask)){
theApplication.haltInteractions();
showTopResults = false;
scanThread=new ScanAnnotationCascadeThread(parentScans,theWorkspace.getFragmentOptions(),theWorkspace.getAnnotationoptions());
scanThread.start();
progressDialog = new ProgressMonitor(theApplication,"Parent scans completed",scanThread.getTarget());
// set up the timer action
activityMonitor = new Timer(200,new ActionListener() {
public void actionPerformed(ActionEvent event) {
int progress = scanThread.getProgress();
// show progress
progressDialog.setProgress(progress);
// check if task is completed or canceled
if (progress == scanThread.getTarget()
|| progressDialog.isCanceled()) {
System.err.println("Stopping activity monitor");
activityMonitor.stop();
progressDialog.close();
if (progress != scanThread.getTarget()) {
scanThread.interrupt();
onAnnotationAborted(scanThread);
} else {
onAnnotationCompleted(scanThread);
}
}
}
});
activityMonitor.start();
}
return true;
}
项目:xdat
文件:MainChartMenuActionListener.java
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("Create Parallel Coordinates Chart")) {
// log("Create: discrete level count of last parameter is: "+mainWindow.getDataSheet().getParameter(mainWindow.getDataSheet().getParameterCount()-1).getdiscreteLevelCount());
if (mainWindow.getDataSheet() == null) {
JOptionPane.showMessageDialog(mainWindow,"Please create a data sheet first by selecting Data->Import.","Create Chart",JOptionPane.@R_389_4045@ION_MESSAGE);
} else {
ProgressMonitor progressMonitor = new ProgressMonitor(mainWindow,"Building Chart...",100);
progressMonitor.setProgress(0);
ParallelCoordinatesChartCreationThread sw = new ParallelCoordinatesChartCreationThread(mainWindow,progressMonitor);
sw.execute();
}
}
else if (e.getActionCommand().equals("Create Scatter Chart 2D")) {
if (mainWindow.getDataSheet() == null) {
JOptionPane.showMessageDialog(mainWindow,JOptionPane.@R_389_4045@ION_MESSAGE);
} else {
ScatterChart2D chart = new ScatterChart2D(mainWindow.getDataSheet(),true,new Dimension(600,600),mainWindow.getUniqueChartId(ScatterChart2D.class));
try {
new ChartFrame(mainWindow,chart);
this.mainWindow.getCurrentSession().addChart(chart);
} catch (noparametersDefinedException e1) {
JOptionPane.showMessageDialog(mainWindow,"Cannot create chart when no parameters are defined.","No parameters defined!",JOptionPane.ERROR_MESSAGE);
}
}
} else {
System.out.println(e.getActionCommand());
}
}
项目:aceview
文件:UpdateAnswersUI.java
public void updateAnswers() {
final int questionCount = questions.size();
if (questionCount == 0) {
showMessage(JOptionPane.@R_389_4045@ION_MESSAGE,NO_QUESTIONS_MESSAGE);
return;
}
try {
if (! mngr.getreasoner().isClassified()) {
showMessage(JOptionPane.WARNING_MESSAGE,NSYNC_MESSAGE);
}
} catch (OWLreasonerException e) {
showMessage(JOptionPane.ERROR_MESSAGE,e.getMessage());
return;
}
progressMonitor = new ProgressMonitor(parent,"Updating answers to " + questionCount + " questions...",questionCount);
progressMonitor.setProgress(0);
task = new Task();
task.addPropertychangelistener(new Propertychangelistener() {
public void propertyChange(PropertyChangeEvent evt) {
if ("progress" == evt.getPropertyName()) {
int progress = (Integer) evt.getNewValue();
progressMonitor.setProgress(progress);
String message = String.format("Completed %d of %d.\n",progress,questionCount);
progressMonitor.setNote(message);
if (progressMonitor.isCanceled()) {
task.cancel(true);
logger.info("Task cancelled");
}
}
}
});
task.execute();
}
项目:power-matchmaker
文件:MatchResultVisualizer.java
public void actionPerformed(ActionEvent e) {
int response = JOptionPane.showConfirmDialog(getPanel(),warningMessage,"WARNING",JOptionPane.OK_CANCEL_OPTION);
if (response == JOptionPane.OK_OPTION) {
try {
mungeProcess selectedProcess = (mungeProcess) mungeProcessComboBox.getSelectedItem();
AutoMatchWorker worker = new AutoMatchWorker(pool,selectedProcess,session);
ProgressMonitor monitor = new ProgressMonitor(session.getFrame(),"Auto-matching...",100);
ProgressWatcher watcher = new ProgressWatcher(monitor,worker);
watcher.start();
new Thread(worker).start();
} catch (Exception ex) {
MMSUtils.showExceptionDialog(getPanel(),"Auto-Match Failed,most likely a database connection error",ex);
}
}
}
项目:tEFMA
文件:JProgress.java
public JProgress(Mode mode,int n,int iteration,long posCount,long negCount) {
super(mode,n);
final String title;
if (posCount > 0 && negCount > 0) {
final NumberFormat nf = (NumberFormat)NumberFormat.getIntegerInstance().clone();
nf.setGroupingUsed(true);
title = "Iteration " + iteration + "\nAdjacency candidates to check: " + nf.format(posCount * negCount) + "\n\n";
}
else {
title = "Iteration " + iteration + "\nChecking adjacency candidates...\n\n";
}
jmonitor = new ProgressMonitor(null,title,"Progress: 0%",1000);
}
项目:incubator-taverna-workbench
文件:ImportWorkflowWizard.java
public void actionPerformed(ActionEvent e) {
/*
* if (e.getSource() instanceof Component) { parentComponent = (Component)
* e.getSource(); } else { parentComponent = null; }
*/
parentComponent = MainWindow.getMainWindow();
Thread t = new Thread(this,"Import workflow");
progressMonitor = new ProgressMonitor(parentComponent,"Importing workflow",100);
progressMonitor.setMillisToDecidetoPopup(200);
progressMonitor.setProgress(5);
t.start();
setVisible(false);
}
项目:COrnLathe
文件:IndexPoint.java
/**
* Cut the given surface with this CutPoint.
*
* @param surface Surface
* @param monitor progress monitor which can be canceled
*/
@Override
public synchronized void cutSurface(Surface surface,ProgressMonitor monitor) {
Vector2d cutVectorS = getMoveVector(cutDepth); // cut direction scaled by depth
double cutX = getX() + cutVectorS.x;
double cutZ = getZ() + cutVectorS.y;
double spindleC,lastC = 0.0;
String fullMask = mask;
if (!mask.isEmpty()) {
while (fullMask.length() < getRepeat()) {
fullMask += mask; // fill out to full length
}
}
for (int i = 0; i < getRepeat(); i++) {
if (mask.isEmpty() || (fullMask.charat(i) != '0')) {
spindleC = 360.0 * (double) i / (double) getRepeat() - getPhase() / (double) getRepeat(); // minus to match Rosette phase
surface.rotateZ(spindleC - lastC); // incremental rotate the surface
if (cutter.canFastRender()) {
surface.cutSurface(cutter,spindleC); // fast cut rendering only for IDEAL HCF
} else {
surface.cutSurface(cutter,cutZ);
}
lastC = spindleC;
}
}
surface.rotateZ(360.0 - lastC); // bring it back to the starting point
}
项目:COrnLathe
文件:OffsetGroup.java
@Override
public synchronized void cutSurface(Surface surface,ProgressMonitor monitor) {
if (cpList.isEmpty() || (repeat <= 0)) {
return;
}
double zRotation = indexOffsetdegrees();
if (zRotation != 0.0) {
surface.rotateZ(zRotation); // initial phase rotation
}
outerloop:
for (int i = 0; i < repeat; i++) {
if (i > 0) {
surface.rotateZ(360.0 / repeat); // rotate to the next one
zRotation += 360.0 / repeat; // keep track of cumulative rotation
}
surface.offset(-getX(),0.0,-getZ()); // move the surface over the offset point
surface.rotateY(-getTangentAngle());
// this is where the main work is done
monitor.setProgress(num+1);
monitor.setNote("CutPoint " + getNum() + ": " + i + "/" + repeat + "\n");
for (CutPoint cPt : cpList) {
if (cPt instanceof OffRosettePoint) {
Vector2d offsetPt = offsetForCutPoint(cPt);
((OffRosettePoint) cPt).cutSurface(surface,offsetPt.x,offsetPt.y); // and cut with it
}
if (monitor.isCanceled()) {
break outerloop;
}
}
surface.rotateY(getTangentAngle());
surface.offset(getX(),getZ()); // move the surface back so that the z rotation will be around the center
}
if (zRotation < 360.0) {
surface.rotateZ(360.0 - zRotation); // this should get you back to original rotation
}
}
项目:COrnLathe
文件:Surface.java
/**
* Rebuild the Surface from the given outline points.
*/
public synchronized final void rebuild() {
pts = makeCleanSurface();
if (render) {
TopComponent window = WindowManager.getDefault().findTopComponent("View3DTopComponent");
// progressMonitor closes with progress >= max,so use size()+1
progressMonitor = new ProgressMonitor(window,"Rendering the surface",cutPtMgr.size()+1);
buildTask = new BuildTask();
buildTask.addPropertychangelistener(this);
buildTask.execute();
} else { // not rendering
pcs.firePropertyChange(PROP_REBUILD,outline); // let listeners kNow we're done
}
}
@Override
public synchronized void cutSurface(Surface surface,ProgressMonitor monitor) {
ArrayList<CutPoint> list = makelistofPoints();
for (int i = 0; i < list.size(); i++) {
monitor.setProgress(num + 1);
monitor.setNote("CutPoint " + getNum() + ": " + i + "/" + list.size() + "\n");
list.get(i).cutSurface(surface,monitor);
if (monitor.isCanceled()) {
break;
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。