地球儀上でISS(国際宇宙ステーション)の位置を表示するプログラム(その6)
public Bitmap sphere(int[] xll, int[] yl, double[] hsa, int iff)
{
Bitmap canvas1 = new Bitmap(bmp3);
Bitmap canvas2 = new Bitmap(h, h);
int xt, yt, kk;
double sx, sy, ll;
int rl = 4;
Graphics g = Graphics.FromImage(canvas2);
Color c;
Pen p = new Pen(Color.FromArgb(128, Color.Red), 1);
kk = (int)((double)keido / 360 * w);
for (int i = 0; i < h - 1; i++)
{
for (int j = 0; j < h - 1; j++)
{
if (x[j, i] >= 0 && x[j, i] <= h)
{
xt = x[j, i] + kk;
if (xt >= w)
xt -= w;
c = canvas1.GetPixel(xt, y[i]);
}
else
{
c = Color.Black;
}
int p2x = (int)(h2 + ((j - h2) * expandSize));
int p2y = (int)(h2 + ((i - h2) * expandSize));
canvas2.SetPixel(p2x, p2y, c);
}
}
for (int i = 0; i < iff + 1; i++)
{
sy = ((double)yl[i] - h2) / (double)h * Math.PI;
yt = (int)(h2 * (Math.Sin(sy) * expandSize * hsa[i] + 1));
ll = h * Math.Cos(sy);
if (((0 < kk && kk < w2) && (kk < xll[i] && xll[i] < kk + w2)) ||
((w2 <= kk) && (kk < xll[i] || xll[i] < kk - w2)))
{
double xtl = xll[i] - kk;
sx = (xtl - h2) / (double)h * Math.PI;
xt = (int)(ll / 2 * Math.Sin(sx) * expandSize * hsa[i] + h2);
if (i == iff)
{
p = new Pen(Color.FromArgb(255, Color.AntiqueWhite), 2);
rl = 6;
}
g.DrawEllipse(p, xt - rl / 2, yt - rl / 2, rl, rl);
}
}
g.Dispose();
return canvas2;
}
private void pictureBox9_MouseDown_1(object sender, MouseEventArgs e)
{
mb2 = true;
}
private void pictureBox9_MouseUp_1(object sender, MouseEventArgs e)
{
mb = false;
mb2 = false;
}
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
{
mMousePoint = new Point(e.X, e.Y);
}
}
private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
{
this.Left += e.X - mMousePoint.X;
this.Top += e.Y - mMousePoint.Y;
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (this.TopMost == false)
this.TopMost = true;
else
this.TopMost = false;
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
1記事あたり20000文字制限があるなんて知らなかった。
ブログってこういうソース記録には向いてないのかな。
自分でサーバーを起こした方がいいのかも知れない。