Resonance condition and field distribution in line-defect photonic crystal cavities